enhance msc flash
This commit is contained in:
parent
9ddcff92a7
commit
45a0f24a31
@ -276,7 +276,8 @@ int32_t tud_msc_write10_cb (uint8_t rhport, uint8_t lun, uint32_t lba, uint32_t
|
|||||||
|
|
||||||
uint32_t addr = lba2addr(lba) + offset;
|
uint32_t addr = lba2addr(lba) + offset;
|
||||||
|
|
||||||
/* 1. queue flash erase pstorage_clear(), return 0 until erasing is done
|
/* 0. Check if flash is the same as data -> skip if matches
|
||||||
|
* 1. queue flash erase pstorage_clear(), return 0 until erasing is done
|
||||||
* 2. queue flash writing, return 0 until writing is complete
|
* 2. queue flash writing, return 0 until writing is complete
|
||||||
* 3. return written bytes.
|
* 3. return written bytes.
|
||||||
*
|
*
|
||||||
@ -287,6 +288,9 @@ int32_t tud_msc_write10_cb (uint8_t rhport, uint8_t lun, uint32_t lba, uint32_t
|
|||||||
{
|
{
|
||||||
case WRITE10_IDLE:
|
case WRITE10_IDLE:
|
||||||
{
|
{
|
||||||
|
// No need to write if flash's content matches with data
|
||||||
|
if ( 0 == memcmp(buffer, (void*) addr, bufsize) ) return bufsize;
|
||||||
|
|
||||||
uint32_t page_addr = align4k(addr);
|
uint32_t page_addr = align4k(addr);
|
||||||
uint32_t off4k = offset4k(addr);
|
uint32_t off4k = offset4k(addr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user