Closed tsandmann closed 5 years ago
no need to check it this way.. if you just delete the lower bits the program will crash too because it will overwrite other variables.
no need to check it this way.. if you just delete the lower bits the program will crash too because it will overwrite other variables.
but SDHC_CardWriteBlock()
would write wrong data to the SD card then resulting in corrupted data on the card.
Yes, It does writes wrong data, if you move the buffer... and the user does not know about it. So where is this better?
its even worse.
Yes, that's why it just checks the alignment and returns -1 to inform the user, if the alignment is wrong. Or do I miss anything here?
oops, forgot about the return.. you're right. forget it.
I really like the idea of using DMA to access the SD card, but you should check the user-supplied buffers to
SDHC_CardReadBlock(()
andSDHC_CardWriteBlock()
for a correct alignment to prevent data corruption. The least 2 significant bits ofSDHC_DSADDR
are always 0 on a K66 device, therefore the buffer address has to be 4 byte aligned.