hi, I try to change the writing on the card LPC2368 rights. I must get the only name of the file that is copied to the memory card from the host. Related data files are located in the buffer BulkBuf function MSC_Memory_Write, (name, extension, date of created....).
I just want to extract the filename BulkBuf and store it in a variable Name. Here is the modified function:
void MSC_MemoryWrite (void) { U32 n;
if ((Offset + BulkLen) > MSC_MemorySize) { BulkLen = MSC_MemorySize - Offset; BulkStage = MSC_BS_CSW; MSC_SetStallEP(MSC_EP_OUT); }
/*Here takes place the copy the host to memory card*/ for (n = 0; n < BulkLen; n++) { Memory[Offset + n] = BulkBuf[n];
/*recovery of the file name*/ for (i=0; i<64; i++){ Name[i] = BulkBuf[i] } } lcd_print(Name);
Offset += BulkLen; Length -= BulkLen;
CSW.dDataResidue -= BulkLen;
if ((Length == 0) || (BulkStage == MSC_BS_CSW)) { LED_Off (LED_WR); CSW.bStatus = CSW_CMD_PASSED; MSC_SetCSW(); } }
The file name is not stored in name, yet according to the description of the FAT, the file name is located ofset 0x00 and coded on 8 bytes (completed 8 characters with spaces).
I don't understand why I do not retrieve the file name ? Please help me ! I started only in microcontroller and programming