Lucent Technologies USS-720 manual WriteFile

Page 64

USS-720

Preliminary User Guide, Rev. 2

USB Device Driver

February 1999

 

 

3 I/O File Functions (continued)

3.3 WriteFile

The WriteFile I/O file function writes data to the Bulk Out 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.3.1 Syntax

 

BOOL

 

WriteFile(

 

HANDLE

hDev,

LPVOID

lpBuffer,

DWORD

nNumberOfBytesToWrite,

LPDWORD

lpNumberOfBytesWritten,

LPOVERLAPPED

lpOverlapped

);

 

3.3.2 Parameters

Input:

hDev—Handle returned from a successful CreateFile.

nNumberOfBytesToWrite—Specifies the number of bytes to be written.

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

Output:

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

lpNumberOfBytesWritten—Pointer to the number of bytes written.

3.3.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.3.4 Notes

See the Win32 SDK documentation for complete definitions.

3.3.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 Out pipe.

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

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

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

STATUS_INSUFFICIENT_RESOURCES—This is an internal error resulting from insufficient memory available to perform a required USB request.

7-6

Lucent Technologies Inc.

Image 64
Contents Introduction Information Manual, Rev SeptemberTable of Contents Information Manual, Rev Evaluation Kit for USS-720 September USB-to-IEEE BridgeIOCTL1284 Terminate USS-720 USB Device Driver Preliminary User GuideIOCTLSET1284REGISTER USS-720 USB Port Monitor Application Note Evaluation Kit Contents Hardware Requirements \SAMPLESOSR2.1 Cable Installation Instructions Getting Started InstructionsSoftware Updates Windows 98 Cable Installation InstructionsPlug and Play USB Driver and Port MonitorPort Creation Eeprom Lucent Technologies Inc Lucent Technologies Microelectronics Group In-System Design, IncUSB Applications Support September Evaluation Kit Software USS-720 Driver Software Object Code License AgreementFebruary IntroductionUSS-720 Software Use Agreement February Licensed SoftwareFurnishing of Licensed Software OwnershipUSS-720 February Software Use AgreementWarranty and Indemnity Agreement PrevailsNothing Construed 04 ConfidentialityPublicity NonassignabilityAddresses IntegrationApplicable Law DisputesUSS720.INF USS720.SYSDocumentation USS-720 Software Use Agreement February Software Components Application Note, Rev FebruaryPlug and Play Operation PnP Customer-Defined DataPrinter Enumeration Power Management Installation ProcessOperating Systems Supported USB Hardware Types SupportedPrinter Types Supported Print Types SupportedPreliminary Data Sheet, Rev September FeaturesDescription Table of Contents Pin Information Preliminary Data Sheet, Rev USS-720USB-to-IEEE Parallel Port nAutoFd Signal Active-Low Parallel Port nSelectIn Signal Active-LowParallel Port nInit Signal Active-Low Parallel Port nAck Signal Active-LowOverview USB PortDevice Descriptor, Configurations, and Inter- faces Descriptor LocationsOnboard Device Descriptor USB-to- Ieee 1284 Bridge SeptemberDevice Descriptor Offset Field Size Value Description USB-to- Ieee Configuration DescriptorInterface Descriptors Bulk Out Endpoint Descriptor, I0A0E1Bulk Out Endpoint Descriptor, I0A1E1 September USB-to-IEEE1284 BridgeBulk In Endpoint Descriptor, I0A1E2 Bulk In Endpoint Descriptor, I0A2E2 Bulk Out Endpoint Descriptor, I0A2E1Interrupt Endpoint Descriptor, I0A2E3 Requests PipesStandard Requests Printer Class-Specific Requests Get Port Status Data Bit DescriptionGET1284REGISTER Vendor-Specific RequestsSET1284REGISTER Ieee 1284 Port Register-Based OperationRegisters GET1284REGISTER Data Byte Register DataInterrupt Pipe Read Data Byte Register DataDefault Bit Symbol Bit Description Status Register Address Bit SymbolParallel Port nFault Signal Reserved Control Register Address Bit Symbol Access Default Bit Symbol Bit DescriptionParallel Port nInit Signal USB-to-IEEE1284 BridgeUSS-720Instant USB ECP Command Register Address Bit Symbol Access Extended Control Register Address Bit Symbol Mode20 DescriptionUSS-720 Control Register Address Bit Symbol USS-720 Setup Register Address Bit Symbol Interrupts External Circuitry Requirements External Crystal ConnectionFilter Bypass Mode High Drive ModeSelf-Powered Mode Absolute Maximum Ratings Parameter Symbol Min UnitElectrical Characteristics Parameter Symbol Test Conditions Min Typ Max UnitCapacitance Values Parameter Unit Clklo ClkhiSetup and Hold Input Timing Parameter Timing CharacteristicsOutput Delay Timing Parameter Min Max Unit Outline Diagram Ordering InformationPin Mqfp Device Code Package ComcodeApplication Note February Description Parallel PortBridging USB to Typical Circuit Showing USSLucent Technologies Inc Signal Directions Preliminary User Guide, Rev FebruaryIOCTL1284 Setmode Initialization O File FunctionsPreliminary User Guide, Rev USS-720 February USB Device DriverCreateFile Error Codes ReadFileWriteFile DeviceIoControl CloseHandle O Control Codes Control Code DescriptionIOCTL1284 Ecpfwdtorev ParametersIOCTL1284ECPREVTOFWD IOCTL1284 Ecpsetchannel Register Mode Description IOCTL1284 SetmodeIOCTL1284 Terminate Ioctlabortpipe Value DescriptionBulkoutpipe BulkinpipeIoctlcancelpiperequest IOCTLGET1284REGISTER Ioctlgetaltsetting ALTINTERFACE0ALTINTERFACE1 ALTINTERFACE2Ioctlgetcapabilities Ioctlgetconfigurationdescriptor Ioctlgetdevicedescriptor Ioctlgetdeviceinstances Ioctlgetinterface Ioctlgetportstatus Bit MeaningIOCTLISSUEUSS720COMMAND Command DescriptionIoctlreadinterruptpipe Byte DescriptionIoctlresetpipe IOCTLSET1284REGISTER Ioctlsetaltsetting Ioctlsoftreset O Control Data Structures DeviceinstanceheaderDeviceinstance Data StructureREGISTER1284 REGISTER1284, *PREGISTER1284ADVREGISTER1284 ADVREGISTER1284, *PADVREGISTER1284Lucent Technologies Inc USS-720 USB Port Monitor USS-720 Application Note USB Port Monitor February Printer Cable with Instant USBSoftware Installation Instructions W98USS720EvalKit2402.zip to download the installation filesApplication Note June Click on Enter LibrarySeptember MN99-052CMPR-1 Replaces MN97-061CMPR-04