USB low-full-high speed peripherals Forum Discussions
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;
}
Show Less
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;
}
Show Less
Show Less
I am from software domain. I am having the package "CySuiteUSB_3_4_1_B20.zip" with drivers on windows xp/vista (win32/x64) for the 'Cypress USB hardware device'. There is a new requirement for the development of the application to work with this device on "Mac OS". How and where can I get the drivers for "Mac" OS platform?
The availability of 'sample source code' for MAC for accessing the device will also be helpful to me for the application development in Mac to access(read/write) the device.
Thanks and Regards. Show Less
Posted here and in Host forum...
Anybody out there done this with frameworks for the CY7C67300? I am trying to implement a CDC PSTN ACM...
I have a fwx_class_handler, and call susb_send, but this seems to generate a new transaction rather than inserting a packet into the data stage of the class request.
code fragment:
// Interface 0, Control EndPoint (0)
static USBTXRXINFO VCPClassMsgInfo ATTR_USB_XFER_BUF_SECTION
= { 0 } ;
static uint8 VCPClassDataBuffer[CLASS_BUFFER_SIZE] ATTR_USB_XFER_BUF_SECTION
= { 0 } ;
void susb2_class_handler ( struct USB_DEVICE_REQUEST *pRequest )
{
...
case GET_LINE_CODING: // Optional for class, returns UART control line structure
if (...check pRequest contents){
memcpy(VCPClassDataBuffer, &LineCoding, sizeof(LINE_CODING_STRUCTURE));
VCPClassMsgInfo.buffer = VCPClassDataBuffer ;
VCPClassMsgInfo.length = sizeof(LINE_CODING_STRUCTURE) ;
VCPClassMsgInfo.done_func = & ClassCommandDone ;
susb_send ( FALCON_SLAVE_SIE, EP0, & VCPClassMsgInfo ) ;
}
else{//failed errorcheck, so stall the endpoint
susb2_stall ( ) ;
}
break;
...
}
Raised a support request but deadly silence for three days now.
?
Thanks
maybe someone can help me. I have a problem and i don't know what i'm doing wrong.
I have a waveform (only with 'normal' states) that is working fine. But i want to implement it with a flow state.
The waveform is used to read out data from an imager.
Some data:
- USB controler runs at 48 MHz
- GPIF runs at 48 MHz
- imager runs at 12 MHz
- LINE_VLD: line valid signal from the imager; while LINE_VLD=1 the imager puts valid data on the bus
Because the imager runs at 12 MHz the waveform contains 2 states and 2 decision points (so the GPIF will run at 48 MHz but read with 12 MHz).
This works fine for waveform 0 ('normal' states). But how can i do this with a flow state (waveform 2)?
I have uploaded the waveforms:
http://img230.imageshack.us/gal.php?g=waveform0.png Show Less
I have a CY7C68053 interfaced to an FPGA, which can feed image data from a frame buffer.
Originally intended to do a custom protocol, with simple endpoint0 control and another endpoint for data from FPGA to host (CE single-board computer).
I am now exploring the possibility of going all the way to comply with USB Still Image Class.
Does Cypress have a reference design for it? Has anyone implemented it on a FX2? Consultants welcome.
Show Less
I already done a coding (in vc++) for CY7C68013A in BulkDatatransfer mode,now I
want to transfer data using isochronous mode .I went through CyAPI.pdf...but cant find a solution...How can I write code for LOOPBACKthe data using HighSpeed...
Thanks in advance.... Show Less
I am using a CY7C68001 that i access from a FPGA.
I use the standard endpont settings as below:
EP2 Bulk OUT, 512 bytes/packet, 2x buffered
EP4 Bulk OUT, 512 bytes/packet, 2x buffered
EP6 Bulk IN, 512 bytes/packet, 2x buffered
EP8 Bulk IN, 512 bytes/packet, 2x buffered
I have managed to write down the descriptor to the chip and it does also enumerates
when the USB connector is connected to my PC.
I have managed to send data from my FPGA via the cypress chip using Endpoint 6.
I receive the data in my PC in my own VB program that uses the CyUSB driver.
Now, my problem is that i just does not understand how to receive data in the FPGA
when data is sent in the opposite direction (PC->FPGA) using Endpoint 2.
My questions are:
Q1
I send smaller batches of data than the buffer size of 512 bytes.
I plan to use the empty flag to check if there is any data in the endpoint buffer.
How do i know how many data bytes to read from the buffer?
Or must i alwayas read all 512 bytes and then myself figure out how much useful data i received?
Q2
When i have read data from the Endpoint buffer, how do i tell the cypress chip that i am ready
with the endpoint buffer and it can be used for the next batch of data?
Any help would be helpful.
BR Paul Show Less
I need to edit the data from read from nand flash before they are sent to the USB via EP4. However the current ways the data is read and sent through to the USB are all done automatically without CPU's knowledge. I tried to disable EP4's Auto bit, EP4FIFOCFG = bmINFM and then while (!(GPIFTRIG&0x80)); // poll ep4 done
this does not seem work, I am still unable to get the data read from nand flash in EP4FIFO.
Help!... Show Less