It is currently Sun Jan 21, 2018 11:39 am

All times are UTC - 5 hours




 Page 1 of 1 [ 4 posts ] 
Author Message
 Post subject: Working on OS X programmer, need help
PostPosted: Sun May 11, 2008 1:38 pm 

Joined: Sun May 11, 2008 1:09 pm
Posts: 2
I've started working on an OS X programmer based loosely on the colecocli source, using my Colecovision 128-in-1 cart.

I'm trying to use the native OS X IOUSBLib interface (rather than making people download and install usblib separately), and I've run into a bit of a problem.

In my equivalent of send_command_wait_complete(), I'm trying to send a COMMAND_TRANSMIT_SECTOR (0xF2) command. While waiting for the operation to finish, I get three STATE_PROCESS_COMMAND packets, and then it just starts sending sector data packets, with three STATE_PROCESS_COMMAND packets bewteen each 512 bytes.

I never see a status message with OPERATION_COMPLETE, and the only reason it ever exits is because it finds a Colecovision rom that starts with 0xAA, which happens to be the right byte in the right place.

Does anyone have any idea why I wouldn't see an OPERATION_COMPLETE status message? It doesn't look like I'm missing any of the sector data messages, so I don't think something is randomly dropping packets.

If necessary, I can zip up my code for someone to look at it. (I'm using XCode on Tiger 10.4.)

If all else fails, I think I can work around this, but I'd rather find out why I never see OPERATION_COMPLETE.

usbReadSector: sectorNum = 0
usbSendCommand: command=0xf2  parm1=0x0  parm2=0x0
usbSendCommandWaitComplete: waiting for OPERATION_IN_PROGRESS (0x2)
usbReadDevice: 00 01 03 FB  02
usbReadDevice: 00 F2 02 00  03
usbSendCommandWaitComplete: waiting for OPERATION_COMPLETE (0xaa)
usbReadDevice: 00 F2 02 00  03
usbReadDevice: 00 F2 02 00  03
usbReadDevice: 82 3E 55 AA  67
usbReadDevice: 02 3E 32 30  69
usbReadDevice: 02 3E 48 70  16
usbReadDevice: 02 3E ED B0  CD
usbReadDevice: 02 3E DE 85  00
usbReadDevice: 02 3E 21 3E  3A
usbReadDevice: 02 3E 20 1E  82
usbReadDevice: 02 3E FE 08  00
usbReadDevice: 42 10 2F 57  00
usbReadDevice: 00 F2 02 00  03
usbReadDevice: 00 F2 02 00  03
usbReadDevice: 00 F2 02 00  03
usbReadDevice: 82 3E 0A BB  06
...
usbReadDevice: 42 10 FF FF  FF
usbReadDevice: 00 F2 02 00  03
usbReadDevice: 00 F2 02 00  03
usbReadDevice: 00 F2 02 00  03
usbReadDevice: 82 3E AA 55  20
usbSendCommandWaitComplete: found OPERATION_COMPLETE
usbReadSector: usbSendCommand = 0x55
usbReadSector: 02 3E 20 20  C6
0000: 02 3e 20 20 20 20 2f 46 4f 52 20 31 39 38 37 cd
0010: 14 87 cd b6 b3 cd 67 87 cd 7f 1f 3e b0 11 20 00
0020: 21 00 20 df cd 2d 88 cd f6 86 cd c0 80 01 0c 00
0030: cd 9a 87 fe 0a 28 45 d4 c0 80 30 f1 c6 30 47 3a


Offline
 Profile  
 
 Post subject:
PostPosted: Tue May 13, 2008 6:03 am 
ERROR AT LINE 0
User avatar

Joined: Tue Aug 05, 2003 9:55 am
Posts: 1035
Location: Cleveland, Ohio
Hi Bruce,

Looking at my own code for this function I think this is the correct behavior.

For this function the command is sent, then blocks are read in without waiting for any command status message.

Any non-data blocks received during the data transfer are due to data from the flash memory not being ready to transfer yet, but should reflect if the command is still in progress.

Steve


Offline
 Profile  
 
 Post subject:
PostPosted: Tue May 13, 2008 8:30 am 

Joined: Sun May 11, 2008 1:09 pm
Posts: 2
I found my problem: send_command_wait_complete() shouldn't be called by data read commands! That only works for commands that return no data. When data is expected, send_command() and wait_transfer_buffer_in() should be used instead.

That'll teach me to pay more attention.


Offline
 Profile  
 
 Post subject:
PostPosted: Mon May 19, 2008 10:21 am 
ERROR AT LINE 0
User avatar

Joined: Tue Aug 05, 2003 9:55 am
Posts: 1035
Location: Cleveland, Ohio
Is this going to have a GUI? Let me know if you need any other help.

Steve


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: