?? ezusbsys.h
字號:
//////////////////////////////////////////////////////////////////////
//
// File: ezusbsys.h
// $Archive: /USB/Drivers/ezusbdrv/ezusbsys.h $
//
// Purpose:
// Header file for the Ezusb USB Device Driver
//
// Environment:
// kernel mode
//
// $Author: Mdn $
//
// $History: ezusbsys.h $
//
// ***************** Version 5 *****************
// User: Mdn Date: 10/06/00 Time: 10:08a
// Updated in $/USB/Drivers/ezusbdrv
// Added IOCTL_EZUSB_SET_FEATURE
//
// ***************** Version 4 *****************
// User: Mdn Date: 8/17/00 Time: 9:46a
// Updated in $/USB/Drivers/ezusbdrv
// added a generic get descriptor function.
//
// ***************** Version 3 *****************
// User: Mdn Date: 8/04/00 Time: 11:40a
// Updated in $/USB/Drivers/ezmon
// added support for monitor download to FX2
//
// ***************** Version 2 *****************
// User: Mdn Date: 7/21/00 Time: 4:27p
// Updated in $/USB/Drivers/ezusbdrv
// Added a Started flag to the device extension. This flag gets set after
// the device has successfully Started. It is used to prevent a potential
// race condition where an application could get a handle (with
// CreateFile()) before the device is completely enumerated.
//
// ***************** Version 1 *****************
// User: Tpm Date: 6/09/00 Time: 6:32p
// Created in $/USB/Drivers/ezusbdrv
//
// ***************** Version 30 *****************
// User: Tpm Date: 3/14/00 Time: 4:14p
// Updated in $/EzUsb/Examples/Unsupported/EzMr
// Added commets:
// DEVIOCTL.H is a Microsoft header file.
// DEVIOCTL.H is normally obtained by installing the Windows DDK.
//
// ***************** Version 29 *****************
// User: Markm Date: 5/18/99 Time: 3:37p
// Updated in $/EzUsb/Drivers/ezusbdrv
//
// ***************** Version 28 *****************
// User: Markm Date: 2/23/99 Time: 9:50a
// Updated in $/EzUsb/Drivers/ezusbdrv
// Driver now supports ISO IN streaming with a path to user mode.
//
// ***************** Version 27 *****************
// User: Markm Date: 2/10/99 Time: 3:32p
// Updated in $/EzUsb/Drivers/ezusbdrv
// removed lots of unused protoypes and structures. Added ring buffer
// support functions.
//
// ***************** Version 26 *****************
// User: Markm Date: 2/01/99 Time: 11:57a
// Updated in $/EzUsb/Drivers/ezusbdrv
// Added preliminary support for ISO streaming.
//
// ***************** Version 25 *****************
// User: Tpm Date: 10/19/98 Time: 3:45p
// Updated in $/EzUsb/Examples/CTst
// Fix RMA#1 bug: side B fails renum.
//
// ***************** Version 24 *****************
// User: Tpm Date: 10/01/98 Time: 11:51p
// Updated in $/EzUsb/Examples/Unsupported/EzMr
// Apply Tim's Comments.
//
// ***************** Version 23 *****************
// User: Tpm Date: 6/26/98 Time: 10:27a
// Updated in $/EzUsb/Examples/EzMr
// Set Version.
//
// ***************** Version 22 *****************
// User: Tpm Date: 6/26/98 Time: 5:41a
// Updated in $/EzUsb/Examples/EzMr
// Pre-Build.
//
// ***************** Version 21 *****************
// User: Tpm Date: 6/26/98 Time: 4:01a
// Updated in $/EzUsb/Examples/CTst
// Clean Build.
//
// ***************** Version 20 *****************
// User: Tpm Date: 6/26/98 Time: 2:41a
// Updated in $/EzUsb/Examples/EzMr
// Clean Build.
//
// ***************** Version 19 *****************
// User: Tpm Date: 6/25/98 Time: 1:09p
// Updated in $/EzUsb/EzMr
// Add Headers.
//
// ***************** Version 18 *****************
// User: Tpm Date: 6/25/98 Time: 10:50a
// Updated in $/EzUsb/EzMr
// REL1.1.
//
// ***************** Version 17 *****************
// User: Markm Date: 4/09/98 Time: 3:01p
// Updated in $/EZUSB/ezusb driver
// Added stuff to support download of Intel Hex records.
//
// ***************** Version 16 *****************
// User: Markm Date: 4/07/98 Time: 1:53p
// Updated in $/EZUSB/ezusb driver
// Added IOCTL_EZUSB_GET_DRIVER_VERSION
//
// ***************** Version 15 *****************
// User: Markm Date: 4/06/98 Time: 4:27p
// Updated in $/EZUSB/ezusb driver
// Modified ISO transfer code.
// * Transfer descriptors for the ISO transfer are now sent up to the
// caller along with the actual data, so the caller can get the status of
// the transfer on a packet-by-packet basis.
// * Disabled default values. Caller must specify all fields in the ISO
// control structure.
// * Corrected bug where the Stream and Transfer objects weren't being
// freed.
//
// Added some code to measure the latency of a bulk transfer.
//
// ***************** Version 14 *****************
// User: Markm Date: 3/19/98 Time: 10:13a
// Updated in $/EZUSB/ezusb driver
// Added IOCTL_EZUSB_ANCHOR_DOWNLOAD to support A0 loads to a specific
// memory offset.
//
// ***************** Version 13 *****************
// User: Markm Date: 2/26/98 Time: 4:05p
// Updated in $/EZUSB/ezusb driver
// Added protoypes for anchor download and 8051 reset functions.
// Added firmware structure definition.
// Added some EZ-USB register defines.
//
// ***************** Version 11 *****************
// User: Markm Date: 2/11/98 Time: 9:51a
// Updated in $/EZUSB/ezusb driver
// Added an open file handle count to the device extension.
//
// ***************** Version 10 *****************
// User: Markm Date: 2/02/98 Time: 3:36p
// Updated in $/EZUSB/ezusb driver
// Added protypes for new functions
//
// ***************** Version 9 *****************
// User: Markm Date: 1/27/98 Time: 11:37a
// Updated in $/EZUSB/ezusb driver
// Added members to the ISO stream object to allow for user specified
// transfer parameters.
//
// ***************** Version 8 *****************
// User: Markm Date: 1/22/98 Time: 11:52a
// Updated in $/EZUSB/ezusb driver
// removed unused code.
// added IOCTL's for ISO loopback/read/write
//
// ***************** Version 7 *****************
// User: Markm Date: 1/18/98 Time: 3:18p
// Updated in $/EZUSB/ezusb driver
// Added new IOCTL's. Added members to the device extension to support
// robust device removal.
//
// ***************** Version 6 *****************
// User: Markm Date: 1/14/98 Time: 10:30a
// Updated in $/EZUSB/ezusb driver
// Added IOCTL's for handling bulk transfers.
//
// ***************** Version 5 *****************
// User: Markm Date: 1/02/98 Time: 1:41p
// Updated in $/EZUSB/ezusb driver
// Added support for setting the interface, preliminary code for naming
// pipes, get string descriptor
//
// ***************** Version 4 *****************
// User: Markm Date: 11/18/97 Time: 3:21p
// Updated in $/EZUSB/ezusb driver
// added abort pipe IOCTL
//
// ***************** Version 3 *****************
// User: Markm Date: 11/14/97 Time: 4:31p
// Updated in $/EZUSB/ezusb driver
// added code to experiment wth different methods of switiching
// interfaces.
//
// ***************** Version 2 *****************
// User: Markm Date: 11/07/97 Time: 1:21p
// Updated in $/EZUSB/ezusb driver
// Added Reset Pipe IOCTL
//
// Copyright (c) 1997 Anchor Chips, Inc. May not be reproduced without
// permission. See the license agreement for more details.
//
//////////////////////////////////////////////////////////////////////
//
// Vendor specific request code for Anchor Upload/Download
//
// This one is implemented in the core
//
#define ANCHOR_LOAD_INTERNAL 0xA0
//
// These commands are not implemented in the core. Requires firmware
//
#define ANCHOR_LOAD_EXTERNAL 0xA3
#define ANCHOR_ISFX2 0xAC
//
// This is the highest internal RAM address for the AN2131Q
//
#define MAX_INTERNAL_ADDRESS 0x1B3F
#define INTERNAL_RAM(address) ((address <= MAX_INTERNAL_ADDRESS) ? 1 : 0)
//
// EZ-USB Control and Status Register. Bit 0 controls 8051 reset
//
#define CPUCS_REG_EZUSB 0x7F92
#define CPUCS_REG_FX2 0xE600
#ifndef _BYTE_DEFINED
#define _BYTE_DEFINED
typedef unsigned char BYTE;
#endif // !_BYTE_DEFINED
#ifndef _WORD_DEFINED
#define _WORD_DEFINED
typedef unsigned short WORD;
#endif // !_WORD_DEFINED
typedef struct _VENDOR_REQUEST_IN
{
BYTE bRequest;
WORD wValue;
WORD wIndex;
WORD wLength;
BYTE direction;
BYTE bData;
} VENDOR_REQUEST_IN, *PVENDOR_REQUEST_IN;
///////////////////////////////////////////////////////////
//
// control structure for bulk and interrupt data transfers
//
///////////////////////////////////////////////////////////
typedef struct _BULK_TRANSFER_CONTROL
{
ULONG pipeNum;
} BULK_TRANSFER_CONTROL, *PBULK_TRANSFER_CONTROL;
typedef struct _BULK_LATENCY_CONTROL
{
ULONG bulkPipeNum;
ULONG intPipeNum;
ULONG loops;
} BULK_LATENCY_CONTROL, *PBULK_LATENCY_CONTROL;
///////////////////////////////////////////////////////////
//
// control structure isochronous loopback test
//
///////////////////////////////////////////////////////////
typedef struct _ISO_LOOPBACK_CONTROL
{
// iso pipe to write to
ULONG outPipeNum;
// iso pipe to read from
ULONG inPipeNum;
// amount of data to read/write from/to the pipe each frame. If not
// specified, the MaxPacketSize of the out pipe is used.
ULONG packetSize;
} ISO_LOOPBACK_CONTROL, *PISO_LOOPBACK_CONTROL;
///////////////////////////////////////////////////////////
//
// control structure for sending vendor or class specific requests
// to the control endpoint.
//
///////////////////////////////////////////////////////////
typedef struct _VENDOR_OR_CLASS_REQUEST_CONTROL
{
// transfer direction (0=host to device, 1=device to host)
UCHAR direction;
// request type (1=class, 2=vendor)
UCHAR requestType;
// recipient (0=device,1=interface,2=endpoint,3=other)
UCHAR recepient;
//
// see the USB Specification for an explanation of the
// following paramaters.
//
UCHAR requestTypeReservedBits;
UCHAR request;
USHORT value;
USHORT index;
} VENDOR_OR_CLASS_REQUEST_CONTROL, *PVENDOR_OR_CLASS_REQUEST_CONTROL;
typedef struct _SET_FEATURE_CONTROL
{
USHORT FeatureSelector;
USHORT Index;
} SET_FEATURE_CONTROL, *PSET_FEATURE_CONTROL;
///////////////////////////////////////////////////////////
//
// control structure for isochronous data transfers
//
///////////////////////////////////////////////////////////
typedef struct _ISO_TRANSFER_CONTROL
{
//
// pipe number to perform the ISO transfer to/from. Direction is
// implied by the pipe number.
//
ULONG PipeNum;
//
// ISO packet size. Determines how much data is transferred each
// frame. Should be less than or equal to the maxpacketsize for
// the endpoint.
//
ULONG PacketSize;
//
// Total number of ISO packets to transfer.
//
ULONG PacketCount;
//
// The following two parameters detmine how buffers are managed for
// an ISO transfer. In order to maintain an ISO stream, the driver
// must create at least 2 transfer buffers and ping pong between them.
// BufferCount determines how many buffers the driver creates to ping
// pong between. FramesPerBuffer specifies how many USB frames of data
// are transferred by each buffer.
//
ULONG FramesPerBuffer; // 10 is a good value
ULONG BufferCount; // 2 is a good value
} ISO_TRANSFER_CONTROL, *PISO_TRANSFER_CONTROL;
///////////////////////////////////////////////////////////
//
// control structure for Anchor Downloads
//
///////////////////////////////////////////////////////////
typedef struct _ANCHOR_DOWNLOAD_CONTROL
{
WORD Offset;
} ANCHOR_DOWNLOAD_CONTROL, *PANCHOR_DOWNLOAD_CONTROL;
#define MAX_INTEL_HEX_RECORD_LENGTH 16
typedef struct _INTEL_HEX_RECORD
{
BYTE Length;
WORD Address;
BYTE Type;
BYTE Data[MAX_INTEL_HEX_RECORD_LENGTH];
} INTEL_HEX_RECORD, *PINTEL_HEX_RECORD;
typedef struct _SET_INTERFACE_IN
{
UCHAR interfaceNum;
UCHAR alternateSetting;
} SET_INTERFACE_IN, *PSET_INTERFACE_IN;
typedef struct _GET_STRING_DESCRIPTOR_IN
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -