Lucent Technologies USS-720 manual ReadFile, Error Codes

Page 63

Preliminary User Guide, Rev. 2

USS-720

February 1999

USB Device Driver

 

 

3 I/O File Functions (continued)

3.2 ReadFile

The ReadFile I/O file function reads data from the Bulk In pipe and returns TRUE if the function is successful and FALSE if it fails. Details regarding the syntax, parameters, return values, and error codes are listed below.

3.2.1 Syntax

 

BOOL

 

ReadFile(

 

HANDLE

hDev,

LPVOID

lpBuffer,

DWORD

nNumberOfBytesToRead,

LPDWORD

lpNumberOfBytesRead,

LPOVERLAPPED

lpOverlapped

);

 

3.2.2 Parameters

Input:

hDev—Handle returned from a successful CreateFile.

nNumberOfBytesToRead—Specifies the number of bytes to read from the device.

lpOverlapped—Pointer to an OVERLAPPED structure. This is an optional parameter that can be “NULL” if overlap- ping I/O is not required.

Output:

lpBuffer—Pointer to the buffer to receive data from the Bulk In pipe of the device. This buffer is assumed to be in locked system memory allocated from the nonpaged pool.

lpNumberOfBytesRead—Pointer to the number of bytes that were read.

3.2.3 Return Values

If the function succeeds, the return value is TRUE (1).

If the function fails, the return value is FALSE (0). To get extended error information, call GetLastError.

3.2.4 Notes

See the Win32 SDK documentation for complete definitions.

3.2.5 Error Codes

ERROR_DEVICE_REMOVE—The device instance has been removed.

ERROR_DEVICE_STOP—The device instance has been stopped.

ERROR_INVALID_ALTERNATESETTING—The current alternate interface setting for this device instance does not support the Bulk In pipe.

ERROR_PIPE_ALREADY_OPEN—The Bulk In pipe for this device instance is already open.

STATUS_INVALID_HANDLE—The Bulk In pipe handle is invalid for this device instance.

STATUS_INVALID_PARAMETER—The pipe type is invalid for this device instance.

STATUS_INSUFFICIENT_RESOURCES—Not enough memory to allocate a request to read Bulk In on this device instance.

Lucent Technologies Inc.

7-5

Image 63
Contents Information Manual, Rev September IntroductionTable of Contents September USB-to-IEEE Bridge Information Manual, Rev Evaluation Kit for USS-720USS-720 USB Device Driver Preliminary User Guide IOCTL1284 TerminateIOCTLSET1284REGISTER USS-720 USB Port Monitor Application Note Evaluation Kit Contents \SAMPLES Hardware RequirementsGetting Started Instructions OSR2.1 Cable Installation InstructionsWindows 98 Cable Installation Instructions Software UpdatesUSB Driver and Port Monitor Plug and PlayPort Creation Eeprom Lucent Technologies Inc In-System Design, Inc Lucent Technologies Microelectronics GroupUSB Applications Support September Introduction Evaluation Kit SoftwareUSS-720 Driver Software Object Code License Agreement FebruaryOwnership USS-720 Software Use Agreement FebruaryLicensed Software Furnishing of Licensed SoftwareFebruary Software Use Agreement USS-72004 Confidentiality Warranty and IndemnityAgreement Prevails Nothing ConstruedIntegration PublicityNonassignability AddressesDisputes Applicable LawUSS720.SYS USS720.INFDocumentation USS-720 Software Use Agreement February Application Note, Rev February Software ComponentsCustomer-Defined Data Plug and Play Operation PnPPrinter Enumeration USB Hardware Types Supported Power ManagementInstallation Process Operating Systems SupportedPrint Types Supported Printer Types SupportedFeatures Preliminary Data Sheet, Rev SeptemberDescription Table of Contents Preliminary Data Sheet, Rev USS-720 Pin InformationUSB-to-IEEE Parallel Port nAck Signal Active-Low Parallel Port nAutoFd Signal Active-LowParallel Port nSelectIn Signal Active-Low Parallel Port nInit Signal Active-LowDescriptor Locations OverviewUSB Port Device Descriptor, Configurations, and Inter- facesUSB-to- Ieee 1284 Bridge September Onboard Device DescriptorDevice Descriptor Offset Field Size Value Description Configuration Descriptor USB-to- IeeeBulk Out Endpoint Descriptor, I0A0E1 Interface DescriptorsSeptember USB-to-IEEE1284 Bridge Bulk Out Endpoint Descriptor, I0A1E1Bulk In Endpoint Descriptor, I0A1E2 Bulk Out Endpoint Descriptor, I0A2E1 Bulk In Endpoint Descriptor, I0A2E2Interrupt Endpoint Descriptor, I0A2E3 Pipes RequestsStandard Requests Get Port Status Data Bit Description Printer Class-Specific RequestsVendor-Specific Requests GET1284REGISTERSET1284REGISTER Register-Based Operation Ieee 1284 PortByte Register Data RegistersGET1284REGISTER Data Byte Register Data Interrupt Pipe Read DataStatus Register Address Bit Symbol Default Bit Symbol Bit DescriptionParallel Port nFault Signal Reserved USB-to-IEEE1284 Bridge Control Register Address Bit SymbolAccess Default Bit Symbol Bit Description Parallel Port nInit SignalUSS-720Instant USB ECP Command Register Address Bit Symbol Access Mode20 Description Extended Control Register Address Bit SymbolUSS-720 Control Register Address Bit Symbol USS-720 Setup Register Address Bit Symbol Interrupts External Crystal Connection External Circuitry RequirementsAbsolute Maximum Ratings Parameter Symbol Min Unit Filter Bypass ModeHigh Drive Mode Self-Powered ModeClklo Clkhi Electrical CharacteristicsParameter Symbol Test Conditions Min Typ Max Unit Capacitance Values Parameter UnitTiming Characteristics Setup and Hold Input Timing ParameterOutput Delay Timing Parameter Min Max Unit Device Code Package Comcode Outline DiagramOrdering Information Pin MqfpApplication Note February Description USS ParallelPort Bridging USB to Typical Circuit ShowingLucent Technologies Inc Preliminary User Guide, Rev February Signal DirectionsIOCTL1284 Setmode USB Device Driver InitializationO File Functions Preliminary User Guide, Rev USS-720 FebruaryCreateFile ReadFile Error CodesWriteFile DeviceIoControl CloseHandle Control Code Description O Control CodesParameters IOCTL1284 EcpfwdtorevIOCTL1284ECPREVTOFWD IOCTL1284 Ecpsetchannel IOCTL1284 Setmode Register Mode DescriptionIOCTL1284 Terminate Bulkinpipe IoctlabortpipeValue Description BulkoutpipeIoctlcancelpiperequest IOCTLGET1284REGISTER ALTINTERFACE2 IoctlgetaltsettingALTINTERFACE0 ALTINTERFACE1Ioctlgetcapabilities Ioctlgetconfigurationdescriptor Ioctlgetdevicedescriptor Ioctlgetdeviceinstances Ioctlgetinterface Bit Meaning IoctlgetportstatusCommand Description IOCTLISSUEUSS720COMMANDByte Description IoctlreadinterruptpipeIoctlresetpipe IOCTLSET1284REGISTER Ioctlsetaltsetting Ioctlsoftreset Data Structure O Control Data StructuresDeviceinstanceheader DeviceinstanceREGISTER1284, *PREGISTER1284 REGISTER1284ADVREGISTER1284, *PADVREGISTER1284 ADVREGISTER1284Lucent Technologies Inc USS-720 USB Port Monitor Printer Cable with Instant USB USS-720 Application Note USB Port Monitor FebruaryClick on Enter Library Software Installation InstructionsW98USS720EvalKit2402.zip to download the installation files Application Note JuneSeptember MN99-052CMPR-1 Replaces MN97-061CMPR-04