mirror of https://github.com/ARMmbed/mbed-os.git
general_block_device: optimize test_contiguous_erase_write_read() buffer size for large-sector flashes
parent
4a47709cb0
commit
76cf78d654
|
@ -549,8 +549,15 @@ void test_contiguous_erase_write_read()
|
|||
utest_printf("contiguous_erase_size=0x%" PRIx64 "\n", contiguous_erase_size);
|
||||
|
||||
bd_size_t write_read_buf_size = program_size;
|
||||
if (contiguous_erase_size / program_size > 8 && contiguous_erase_size % (program_size * 8) == 0) {
|
||||
write_read_buf_size = program_size * 8;
|
||||
|
||||
// Reading/writing in larger chunks reduces the number of operations,
|
||||
// helping to avoid test timeouts. Try 256-byte chunks if contiguous_erase_size
|
||||
// (which should be a power of 2) is greater than that. If it's less than
|
||||
// that, the test finishes quickly anyway...
|
||||
if ((program_size < 256) && (256 % program_size == 0)
|
||||
&& (contiguous_erase_size >= 256) && (contiguous_erase_size % 256 == 0)) {
|
||||
utest_printf("using 256-byte write/read buffer\n");
|
||||
write_read_buf_size = 256;
|
||||
}
|
||||
|
||||
// Allocate write/read buffer
|
||||
|
|
Loading…
Reference in New Issue