Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > Problems with Bulk Transfer using CYIOCTL

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



Problems with Bulk Transfer using CYIOCTL
Moderator:
RSKV

Post Reply
Follow this topic



Problems with Bulk Transfer using CYIOCTL

s.koops posted on 28 Oct 2011 1:43 AM PST
Member
4 Forum Posts

Hi,

I'm trying to make a bulk transfer using the IOCTL Interface of the cyusb.sys driver with Delphi, but the DeviceIOControl Function always returns 87 (ERROR_INVALID_PARAMETER).

I'm using the following Code :

procedure NonEP0TransferOut(handle:THandle;endPointAddress:Byte; pBuffer:PBuffer; bufferSize:Word);
const cBufSize = 512;
var
    singleTransfer:SINGLE_TRANSFER;
  buffer : array[0..cBufSize+SizeOf(SINGLE_TRANSFER)-1] of Byte;
  i : Integer;
  dwBytes: DWORD;
begin
    ZeroMemory(@singleTransfer, SizeOf(SINGLE_TRANSFER));

  SingleTransfer.SetupPacket.ulTimeOut := 1000;
  singleTransfer.ucEndpointAddress := endPointAddress;
  singleTransfer.IsoPacketLength := 0;
  singleTransfer.BufferOffset := SizeOf(SINGLE_TRANSFER);
  singleTransfer.BufferLength := bufferSize;
  dwBytes := 0;

    Move(SingleTransfer,Buffer,SizeOf(SINGLE_TRANSFER));

  for i := 0 to bufferSize-1 do begin
      buffer[i+SizeOf(TSingleTransfernEP0)] := pBuffer^[i]; // buffer direkt hinter den SINGLE_TRANFER record schreiben
  end;

  if not DeviceIoControl(    handle,IOCTL_ADAPT_SEND_NON_EP0_TRANSFER,
                          @buffer, bufferSize+SizeOf(SINGLE_TRANSFER),
                          @buffer, bufferSize+SizeOf(SINGLE_TRANSFER),
                          dwBytes,nil) then
      raise ECyUSBException.Create('Error #17 during nonEP0 control Transfer : ' + IntToStr(getLastError()));
end;

The SINGLE_TRANSFER structure seems to be correct. It works fine for EP0 Transfers. I also tried IOCTL_ADAPT_SEND_NON_EP0_DIRECT, which gives the same error. Can someone tell me what I'm doing wrong ?

regards

Simon Koops




Re: Problems with Bulk Transfer using CYIOCTL

s.koops posted on 28 Oct 2011 05:44 AM PST
Member
4 Forum Posts

I have the solution now, i used pipe address instead of descriptor address. now it works



Re: Problems with Bulk Transfer using CYIOCTL

Gayathri posted on 29 Oct 2011 05:33 AM PST
Cypress Employee
428 Forum Posts

 Glad to hear that the problem is solved now, and good that you shared it here.

 

Regards,

Gayathri






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