Universal USB Device Driver (USBIO)
Architecture
USB08 Evaluation Board
Designer Reference Manual
MOTOROLA
Universal USB Device Driver (USBIO)
145
// 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.
Содержание MC68HC908JB8
Страница 2: ...blank ...
Страница 6: ...Designer Reference Manual USB08 Evaluation Board 6 List of Sections MOTOROLA List of Sections ...
Страница 16: ...Designer Reference Manual USB08 Evaluation Board 16 List of Tables MOTOROLA List of Tables ...
Страница 42: ...Designer Reference Manual USB08 Evaluation Board 42 Hardware Description MOTOROLA Hardware Description ...
Страница 88: ...Designer Reference Manual USB08 Evaluation Board 88 USB08 Descriptors MOTOROLA USB08 Descriptors ...
Страница 243: ...blank ...