On 9/7/05 12:50 PM, "email@hidden"
<email@hidden> wrote:
> Message: 1
> Date: Wed, 07 Sep 2005 08:57:52 +1200
> From: Jonathan Selby <email@hidden>
> Subject: trying to get my first ISO read
> To: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hello,
> Been struggling to get one of our devices working under apple. I have been
> looking
> through various device drivers and my first task is to try to communicate with
> my device
> and do an ISO transfer.
>
> I am using an EZ-USB FX and using the sample code I can load my firmware and
> communicate
> with the device using Bulk Out however when I initiate an ISO in I get several
> errors.
>
> Firstly the device stops responding and secondly the USB frame count return is
> always
> 8388608l
>
> I am including code starting from successful completion of a bulk write -
> confirmed by an
> LED response form my device and this initiates an ISO read request. The
> completion routine
> then follows.
>
> I am allocating the buffer and ISOC status arrays with malloc as fer other
> driver samples.
>
> Any clues greatly appreciated.
>
>
>
> void WriteCompletion(void *refCon, IOReturn result, void *arg0)
> {
> IOUSBInterfaceInterface **intf = (IOUSBInterfaceInterface **) refCon;
> UInt32 numBytesWritten = (UInt32) arg0;
> UInt32 numBytesRead;
>
> printf("Async write complete.\n");
> if (kIOReturnSuccess != result)
> {
> printf("error from async bulk write (%08x)\n", result);
> (void) (*intf)->USBInterfaceClose(intf);
> (void) (*intf)->Release(intf);
> return;
> }
> printf("Wrote \"%s\" (%ld bytes) to bulk endpoint\n", kTestMessage,
> numBytesWritten);
>
> IOReturn kr;
>
> unsigned char direction, number, transferType, interval;
> UInt16 maxPacketSize;
> kr= (*intf)->GetPipeProperties(intf, 1,
> &direction,&number,&transferType,&maxPacketSize,&interval);
> printf("return %x, direction %x, number %x, transferType %x, interval %x
> ,maxPacketSize
> %d\n ",kr, direction, number, transferType, interval, maxPacketSize);
>
> UInt64 frame;
> AbsoluteTime atTime;
> kr= (*intf)->GetBusFrameNumber(intf, &frame, &atTime);
> unsigned long int frm=frame;
> printf("return %x, Frame %ul Time %d \n",kr, frm , atTime);
>
> kr= (*intf)->GetPipeStatus(intf, 1);
> printf("GetPipestatus return %x,\n",kr);
> int i;
> for (i=0;i<128;i++)
> {
> frameList[i].frStatus=0;
> frameList[i].frReqCount=128;
> }
> //kr= (*intf)->ResetPipe(intf, 1);
> // printf("reset %x \n",kr);
> kr= (*intf)->ReadIsochPipeAsync( intf,1 , buf, frame+100, 128, frameList,
> ReadCompletion, intf);
> printf("Return from ISOC Read request %x \n", kr);
> printf("intf %x\n",intf);
>
>
> sleep(1);
>
> }
> void ReadCompletion(void *refCon, IOReturn result, void *arg0)
> {
> IOUSBInterfaceInterface **intf = (IOUSBInterfaceInterface **) refCon;
> UInt32 numBytesRead = (UInt32) arg0;
> UInt32 i;
> printf("intf %x\n",intf);
>
>
> printf("Async ISO read complete.\n");
>
> printf("async ISO read return (%08x) Bytes read - %d \n",
> frameList[0].frStatus,
> frameList[0].frActCount);
>
> IOReturn kr;
> UInt64 frame;
> AbsoluteTime atTime;
> unsigned long int frm=frame;
>
> kr= (*intf)->GetBusFrameNumber(intf, &frame, &atTime);
> printf("return %x, Frame %ul Time %d \n",kr, frm , atTime);
>
>
>
> if (kIOReturnSuccess != result)
> {
> printf("error from async ISO read (%08x) Bytes read - %x \n", result,
> numBytesRead);
> (void) (*intf)->USBInterfaceClose(intf);
> (void) (*intf)->Release(intf);
> return;
> }
>
> }
>
>
>
> Here is the output from the software
>
> [Session started at 2005-09-07 08:42:22 +1200.]
> Looking for devices matching vendor ID=4725 and product ID=128
> Raw device added.
> File to open is "12750080.HEX"
> From directory /Users/xfffff/USBNotification Example
> Hello !!!!.
> Raw device removed.
> Hello !!!!.
> Bulk test device added.
> Interface found.
> Interface class 255, subclass 0
> Interface has 2 endpoints.
> pipeRef 1: direction in, transfer type isoc, maxPacketSize 128
> pipeRef 2: direction out, transfer type bulk, maxPacketSize 64
> Async event source added to run loop.
> return 0, Frame 331837835l Time 3954
> intf 302910
> Async write complete.
> Wrote "1111111111111" (1 bytes) to bulk endpoint
> return 0, direction 1, number 8, transferType 1, interval 1 ,maxPacketSize 128
> return 0, Frame 331838892l Time 3954
> GetPipestatus return 0,
> Return from ISOC Read request 0
> intf 302910
> intf 302910
> Async ISO read complete.
> async ISO read return (e00002ed) Bytes read - 0
> return 0, Frame 8388608l Time 3954
> error from async ISO read (e00002ed) Bytes read - 1801400
>
>
>
> --
> Jonathan Selby
> Director - Software Development
> Xaxero Marine Software Engineering Ltd
> at skype.com - xaxjon
> Satellite Phone (00) 88163 142 9922
> Cell Argentina (54) 929 0160 2064
> (00) 64 (0)9 412 7580 fax (00) 64 (0)9 412 7579
> http://www.xaxero.com
> Software for extending your horizon....
>
>
>
> ------------------------------
Jonathan,
don't close the interface in your completion routine just because one of
the (micro) frames completes with an error. Also, you're only dumping the
result of the first of 128 isoc frames - dump them all - some of them
probably completed without error. You probably need to initialize
frActCount, it may not be touched if for some reason the controller never
put the request out onto the bus.
The error (e00002ed) is in IOKit/IOReturn.h, it means
kIOReturnNotResponding. Sometimes this means that your device has gone, in
your case it probably just means that that you missed the frame you
requested, or it hasn't occurred yet.
You probably need to use %llu to as the format specifier for UInt64 too.
hth, Stuart
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden
This email sent to email@hidden