Hi my friends!
I've used RL-ARM mass storage code from sample codes of KEIL 4.03 on AT91SAM7S256. when I attach it to PC , the system recognizes it as a flash disk, correctly;
now I want to change it to apear as a CD-ROM in windows.
I want to know any changes in code.
can anyone help me?
thanks for your help!
> Now we change the code to CD-ROM state , must we see it in cd-rom as before or cd-rom can't show it because of CD IMAGE concepts or other reason?
KEIL original example gives disk image in DiskImage[] ROM array (DiskImg.c). This disk image consists of FAT file system - MBR (Master Boot Record) - Boot sector - FAT - Root directory - File sectors
For CD implementation, you have to replace the contents of the disk image into CD one, which is formatted following to ISO9660 (ECMA-119) spec (see my first post). You may easily make it using a CD-R writer utility, which has a function to make ISO9660 image file.
At the entry of main() (memory.c), the contents of DiskImage[] is copied to Memory[] RAM array. READ10 and WRITE10 access to Memory[] array. For read-only CD, READ10 may directly access to DiskImage[] ROM array, instead of the RAM array.
Tsuneo
Hi my friend Tsuneo!
I do what you post for me but , that didn't work . I changed what you said and I made an iso file and fetch the byte stream of it and changed the code according that (disk Image , size , . . . ) , but when I attach device to computer , my computer (explorer) goes to a wait sate and can't work with the device.
thank my friend!
Hi Mr Chinzei.
Me and my friend Meysam were working around your solution to make our USB Mass storage device a CD-ROM.
BUt As we started the work, lots of problems poped out.
we changed the PDT and Sector size as you guided. We also implemented the following commands as you said: * Read12 * Write12 * Start/Stop unit * Read TOC
Then we loaded an image of a sample CD into device memory.
But it seams we can't get it to work, So I think we have to check it out with the standard specifications.
We searced for some guides or references about this matter and this is what we found:
SCSI Multimedia commands from T10.org.
What i see in here is 6 different versions of MMC commands. I looked in MMC-4 and there's alot of commands for CD-ROM devices in it which I can't get why and how you only choosed a subset of these commands for us to implement.
I am wondering now, whether you know an implementation guidance or a book in which the essential steps for making a CD-ROM device is explained or you use the T10 references too.
Do you know any useful book or guide for my problem?
We could get our CD-ROM to work!
I post the modifications we made to your soluton in order to help others who might read this thread later.
First: I changed the Read TOC function so that it respond to all other read TOC formats too. It is a shame! but I responded all Formats with the same data, Like another USB CD-ROM I was monitoring its commands.
well, my analisys is that we had to make a proper response to any Read TOC which this code do not.
Also the '1' at second if is a logical error.
void MSC_ReadTOC (void) { if ( ((CBW.CB[1] & 0x02) == 0) // MSF field && ((CBW.CB[2] & 0x0F) == 0) // Format field ) { memcpy( BulkBuf, SCSI_TOC_MSF0, sizeof(SCSI_TOC_MSF0) ); BulkLen = sizeof(SCSI_TOC_MSF0); DataInTransfer(); } if ( ((CBW.CB[1] & 0x02) == 1) // MSF field <-----===== Change '1' to '2' && ((CBW.CB[2] & 0x0F) == 0) // Format field ) { memcpy( BulkBuf, SCSI_TOC_MSF1, sizeof(SCSI_TOC_MSF1) ); BulkLen = sizeof(SCSI_TOC_MSF1); DataInTransfer(); } //<-----===== Put the code to handle other formats here, even if you going to fail it(i did not test the fail myself) }
After this the CD can be succecfully recognized in windows, but it has two halts(1 min each). These halts happen after failing "Read Disc Information" and "Get Configuration Commands" which was removed after implementing these commads based on MMC commands reffrence from T10.org