Mark,
If it is possible to read and write sectors of the SD card it would be possible to perform utFAT directly on the card when the simulator runs.
Yes, I believe it is possible to read and write the sectors of the card directly using IoCtl.
If via USB either a memory stick could be used, or an SD card in a USB reader. Otherwise maybe directly to the SD card in its reader (?)
When I was writing and testing my code, I was using a USB SD card reader, connected to a debian linux virtual machine, running on my Windows 7 desktop box. I'm not sure how you would go about connecting directly to an SD Card reader, because I've never worked with them. But, USB card readers seem to work fine.
At first glance I can't say that I understood much about what routines would be used though....or about how to get started on it.
Possibly the starting point is here (?)
https://msdn.microsoft.com/en-us/library/ff566970(v=vs.85).aspx
On Linux (where I was writing my code), the calls go through the generic SCSI driver, and to the device. I'm not sure what layers are involved on Windows, but that link you posted definitely seems like the right place to start.
I looked up one of the calls that I implemented (a ReadCapacity call), there, and it appears to be doing the exact same thing I was on Linux. I believe, on windows, the DeviceIOControl function is the key to it. On Linux, the function is called IoCtl, but they both take similar parameter lists, and I think they do the same thing. Here's a link to the MSDN docs on the windows version:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa363216(v=vs.85).aspxThe IoCtl function can be used to interact directly with the driver layer of a device, and it allows you to pass device specific commands to the device, and get back the results. For mass storage type devices, I believe the underlying commands are just the SCSI commands that the device supports (at least this seemed to prove true on Linux, because that was what I used when writing my code).
I can post my code for you, if it would help ya. It's written in Free Pascal, but it only wraps 2 of the function calls right now, one to read the device's capacity (i.e. total sectors, and sector size), and one to read a raw sector from the device.
it basically boils down to something like the following:
// Open a file handle to the device
fd := fpOpen('/dev/sdb1', O_RDOnly); // here, /dev/sdb1 is the device Linux mapped to my SD Card reader
// Send IoCtl codes to the device to perform the functions you want
// this is actually a bit more involved when you add in appropriate error handling etc.
fpIoCtl(fd, ...); // The parameters here vary based on what command you want to send. The first parameter is a
fpIoCtl(fd, ...); // a single byte code that represents the command, and the other parameters are for passing data
// in and out of the command.
// Close the device when done
fpClose(fd);
Here's a link to one of the documents I found, documenting the SCSI commands that can be sent via the IoCtl function:
http://www.seagate.com/staticfiles/support/disc/manuals/scsi/100293068a.pdfSorry it took so long to respond, My birthday was Saturday, and my family had all kinds of activities planned for me, so I wasn't able to get online much. :-)
Hope this helps,
Chris