My S19 files always start with "S003", so I wrote a simple check in SCSIList2A(void) to check for this:
void SCSIList2A(void)
{
.
.
.
if(S19FileDone) {
while(!BlockWriteDone) { // Receive all USB data
if((v_LBA >= FATDataSec0)
&& ((BootloaderStatus == BootloaderReady) || (BootloaderStatus == BootloaderStarted))) // Host writing first file to Data sector of drive
{
SRecCharPointer = SRecBufferAddress;
if (GetUSBchar() == 'S' &&
GetUSBchar() == '0' &&
GetUSBchar() == '0' &&
GetUSBchar() == '3')
{
S19FileDone = FALSE;
return;
}
else
{
GetUSBOutFileData(); // Host trying to write to data sector or non S19 file
}
} else // Host trying to write to FAT table
GetUSBOutFileData();
}
.
.
.
}
I had to include ParseS19.h and make SRecCharPointer an extern to get it all to compile