haitest/bspsvs/suite/e32/inc/USBConstants.h
changeset 0 cec860690d41
equal deleted inserted replaced
-1:000000000000 0:cec860690d41
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 // This contains namespace USB
       
    18 
       
    19 #ifndef USBCONSTANTS_H
       
    20 #define USBCONSTANTS_H
       
    21 
       
    22 /**
       
    23  * Namespace for constant variables and data types, common to USBerian 
       
    24  */
       
    25 namespace USB
       
    26 	{
       
    27 	/** 
       
    28 	 * USB logical device driver name 
       
    29 	 * */
       
    30 	#ifdef __WINS__
       
    31 		_LIT(KLDDName, "testusbc");
       
    32 	#else
       
    33 		_LIT(KLDDName, "eusbc");
       
    34 	#endif
       
    35 	
       
    36 	/** 
       
    37 	 * Endpoint type constants - Short descriptions of types 
       
    38 	(see USB 2.0 specification for details) */
       
    39 	
       
    40 	/** 
       
    41 	Control
       
    42 		"Control transfers are intended to support configuration/command/status 
       
    43 		type communication flows between client software and its function. Each 
       
    44 		USB device is required to implement the Default Control Pipe as a message pipe."
       
    45 	*/
       
    46 	_LIT(KEPControl, "Control");
       
    47 	
       
    48 	/**
       
    49 	Bulk
       
    50 		"The bulk transfer type is designed to support devices that need to communicate 
       
    51 		relatively large amounts of data at highly variable times where the transfer can 
       
    52 		use any available bandwidth."
       
    53 	*/
       
    54 	_LIT(KEPBulk, "Bulk");
       
    55 	
       
    56 	/**
       
    57 	Interrupt
       
    58 		"The interrupt transfer type is designed to support those devices that need to 
       
    59 		send or receive data infrequently but with bounded service periods."
       
    60 	*/
       
    61 	_LIT(KEPInterrupt, "Interrupt");
       
    62 	/*
       
    63 	Isochronous 
       
    64 		"Isochronous transfer type provides the requester:
       
    65 		 - guaranteed access to USB bandwidth with bounded latency
       
    66 		 - guaranteed constant data rate through the pipe as long as data is provided to the pipe
       
    67 		 - in the case of a delivery failure due to error, no retrying of the attempt to deliver the data "
       
    68 	*/
       
    69 	_LIT(KEPIsochronous, "Isochronous");
       
    70 	
       
    71 	/**
       
    72 	 *  Endpoint direction constants 
       
    73 	 * */
       
    74 
       
    75 	_LIT(KEPIn, "In"); 		// "IN refers to transfers to the host"
       
    76 	_LIT(KEPOut, "Out"); 	// "OUT refers to transfers from the host."
       
    77 	_LIT(KEPBidirectional, "Bidirectional"); // only for control transfers
       
    78 	
       
    79 	/** 
       
    80 	 * The following are default offsets data in device descriptor 
       
    81 	Offsets are used to set */
       
    82 	const TInt KSpecOffset = 2;
       
    83 	const TInt KVendorOffset = 8;
       
    84 	const TInt KProductIDOffset = 10;
       
    85 	const TInt KReleaseOffset = 12;
       
    86 	
       
    87 	/* Default number of channels to open. Used only to initialize variable with proper value */
       
    88 	const TInt MinNumberOfChannels = 1;
       
    89 	
       
    90 	/* Value which is not used by USB client driver, "For future compatibility, should always be zero." */
       
    91 	const TInt KUSBChannelOpenParameter = 0;
       
    92 	
       
    93 	/* Value for how long to wait before test case ends after re-enumeration */
       
    94 	const TInt KSecond = 1000000; // 1 secs = 1000000 microseconds
       
    95 	
       
    96 	enum TUSBEndPointMode {
       
    97 		ENotChosen = -1,
       
    98 		EBulk,
       
    99 		EInterrupt,
       
   100 		EIsochronous
       
   101 	};
       
   102 	
       
   103 	/** 
       
   104 	* USB Actions indicate which action is done in async call
       
   105 	* The flag is set before async calls to RDevUsbcClient
       
   106 	* It is used by USBReader and USBWriter classes
       
   107 	*/
       
   108 	
       
   109 	enum USBAction
       
   110 		{
       
   111 		
       
   112 		// Read Actions - used by USBReader
       
   113 		ENone, // ENone Used by both USBReader and USBWriter
       
   114 		ERead,		
       
   115 		EReadWithLength, 
       
   116 		EReadUntilShort,
       
   117 		EReadUntilShortWithLength,
       
   118 		EReadOneOrMore,
       
   119 		EReadOneOrMoreWithLength,
       
   120 		EReadError, 
       
   121 		
       
   122 		// Write Actions - used by USBWriter
       
   123 		EWrite,
       
   124 		EWriteFile,
       
   125 		EWriteError
       
   126 
       
   127 		};
       
   128 	
       
   129 	// Read and write buffers 0.5MB by default
       
   130 	const TInt KDefaultReadBufferSize = 1024 * 512; 
       
   131 	const TInt KDefaultWriteBufferSize = 1024 * 512; 
       
   132 	
       
   133 	const TInt KDelayBetweenDataAvailabilityQueries = 1000000;
       
   134 	
       
   135 	const TInt KTransferDataSize5MB = 5242880;
       
   136 	const TInt KMicroSecondsToSecondsMultiplier = 1000000;
       
   137 	}
       
   138 
       
   139 
       
   140 
       
   141 #endif
       
   142