Download Print this page

Motorola USB08 Reference Manual Page 145

Universal serial bus evaluation board using the mc68hc908jb8.
Hide thumbs

Advertisement

USB08 Evaluation Board
MOTOROLA
// setup the data structure for configuration
// use the configuration descriptor with index 0
SetConfiguration.ConfigurationIndex = 0;
// device has 1 interface
SetConfiguration.NbOfInterfaces = 1;
// first interface is 0
SetConfiguration.InterfaceList[0].InterfaceIndex = 0;
// alternate setting for first interface is 0
SetConfiguration.InterfaceList[0].AlternateSettingIndex = 0;
// maximum buffer size for read/write operation is 4069 bytes
SetConfiguration.InterfaceList[0].MaximumTransferSize = 4096;
// configure the device
DeviceIoControl(FileHandle,
IOCTL_USBIO_SET_CONFIGURATION,
&SetConfiguration, sizeof(SetConfiguration),
NULL,0,
&BytesReturned,
NULL
);
// setup the data structure to bind the file handle
BindPipe.EndpointAddress = 0x81; // the device has an endpoint 0x81
// bind the file handle
DeviceIoControl(FileHandle,
IOCTL_USBIO_BIND_PIPE
&BindPipe, sizeof(BindPipe),
NULL,0,
&BytesReturned,
NULL
);
// read (or write) data from (to) the device
// use OVERLAPPED structure if necessary
ReadFile(FileHandle, ...);
// close file handle
CloseHandle(FileHandle);
Refer to the Win32 API documentation for the syntax and the
parameters of the functions SetupDiXxx, CreateFile,
DeviceIoControl, ReadFile, WriteFile, CloseHandle. The file
handle can be opened with the FILE_FLAG_OVERLAPPED flag if
asynchronous behaviour is required.
More code samples that show the usage of the USBIO programming
interface can be found in the USBIO Class Library (USBIOLIB), the
USBIO demo application (USBIOAPP), and the simple console
applications ReaderCpp and ReadPipe.
Universal USB Device Driver (USBIO)
Universal USB Device Driver (USBIO)
Designer Reference Manual
Architecture
145

Advertisement

This manual also for:

Mc68hc908jb8

Comments to this Manuals

Symbols: 0
Latest comments: