Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



ezusb To cyusb
Moderator:
RSKV

Post Reply
Follow this topic



ezusb To cyusb

yingbinchina posted on 13 Jan 2010 7:10 PM PST
Member
2 Forum Posts
hello,

My tast is transfer code using ezusb to cyusb. But I don't know how to do that.

Example:
bool writegpifsingleword(unsigned short da)
{
bool Success=0 ;
long lLen = 2;
unsigned long nBytes;
if (hUsbDevice != INVALID_HANDLE_VALUE )
{

/* The old code are following:

VR.direction = 0; // (0=host to device, 1=device to host)
VR.requestType = 2;
VR.recepient = 0;
VR.request = VX_GPIFSINGLEWRITE;
VR.requestTypeReservedBits = 0;
Success = DeviceIoControl (hUsbDevice,
IOCTL_EZUSB_VENDOR_OR_CLASS_REQUEST,
&VR,
sizeof(VENDOR_OR_CLASS_REQUEST_CONTROL),
(UCHAR*)&da,
2,
&nBytes,
NULL);
*/
// I change them to following:
CCyUSBDevice *USBDevice = new CCyUSBDevice();
CCyControlEndPoint *ept = USBDevice->ControlEndPt;

ept->Direction = DIR_TO_DEVICE;
ept->ReqType = REQ_VENDOR;
ept->Target = TGT_DEVICE;
ept->ReqCode = VX_GPIFSINGLEWRITE;
ept->Value = 1;
ept->Index = 0;

Success = ept->Write((UCHAR*)da,lLen);

return Success;
}

Is that transplant right?
Q1: How to transfer VR.requestTypeReservedBits = 0?
Q2: The function DeviceIoControl can return the data count after run Read or Write,
how to get the count when I use ept->Read(buf, len), or Write, Is there some
equivalent function can get the real transfer data count in cyusb.sys?
Q3: ezusb there is a defination of BULK_TRANSFER_CONTROL, it can set pipenum,
How to do it in cyusb?
Q4: How to transfer this to cyusb:
Success = DeviceIoControl (hUsbDevice,
IOCTL_EZUSB_BULK_READ,
&BR,
sizeof(BULK_TRANSFER_CONTROL),
inbuf,
bc,
&nBytes,
NULL);
Q5: Is following transplant right?
bool ClearStatus()
{
bool Success ;
// VENDOR_OR_CLASS_REQUEST_CONTROL VR;
// unsigned long nBytes;
long lLen = 0;
if (hUsbDevice != INVALID_HANDLE_VALUE )
{
/*
VR.direction = 0; // (0=host to device, 1=device to host)
VR.requestType = 2;
VR.recepient = 0;
VR.request = VR_ClearStatus;
VR.requestTypeReservedBits = 0;
Success = DeviceIoControl (hUsbDevice,
IOCTL_EZUSB_VENDOR_OR_CLASS_REQUEST,
&VR,
sizeof(VENDOR_OR_CLASS_REQUEST_CONTROL),
NULL,
0,
&nBytes,
NULL);
*/
}
ept->Direction = DIR_TO_DEVICE;
ept->ReqType = REQ_VENDOR;
ept->Target = TGT_DEVICE;
ept->ReqCode = VR_ClearStatus;
ept->Write(NULL,lLen);

return Success;
}






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20