def qspi_read_twice(u_boot_console):
expected_read = "Read: OK"
+ timeout = 10000000
# TODO maybe add alignment and different start for pages
for size in random.randint(4, page_size), random.randint(4, total_size), total_size:
addr = u_boot_utils.find_ram_base(u_boot_console)
+ size = size & ~3
# FIXME using 0 is failing for me
- output = u_boot_console.run_command('sf read %x 0 %x' % (addr + total_size, size))
- assert expected_read in output
+ with u_boot_console.temporary_timeout(timeout):
+ output = u_boot_console.run_command('sf read %x 0 %x' % (addr + total_size, size))
+ assert expected_read in output
output = u_boot_console.run_command('crc32 %x %x' % (addr + total_size, size))
m = re.search('==> (.+?)$', output)
if not m:
pytest.fail("CRC32 failed")
expected_crc32 = m.group(1)
- output = u_boot_console.run_command('sf read %x 0 %x' % (addr + total_size + 10, size))
- assert expected_read in output
+ with u_boot_console.temporary_timeout(timeout):
+ output = u_boot_console.run_command('sf read %x 0 %x' % (addr + total_size + 10, size))
+ assert expected_read in output
output = u_boot_console.run_command('crc32 %x %x' % (addr + total_size + 10, size))
assert expected_crc32 in output
# TODO maybe add alignment and different start for pages
for size in random.randint(4, page_size), random.randint(page_size, total_size), total_size:
offset = random.randint(4, page_size)
+ offset = offset & ~3
+ size = size & ~3
size = size - old_size
output = u_boot_console.run_command('crc32 %x %x' % (addr + total_size, size))
m = re.search('==> (.+?)$', output)
timeout = 100000000
start = 0
with u_boot_console.temporary_timeout(timeout):
- output = u_boot_console.run_command('sf erase %x %x' % (eraseoffset, erasesize))
- assert expected_erase in output
+ output = u_boot_console.run_command('sf erase %x %x' % (eraseoffset, erasesize))
+ assert expected_erase in output
- output = u_boot_console.run_command('sf write %x %x %x' % (addr + total_size, old_size, size))
- assert expected_write in output
- output = u_boot_console.run_command('sf read %x %x %x' % (addr + total_size + offset, old_size, size))
- assert expected_read in output
+ with u_boot_console.temporary_timeout(timeout):
+ output = u_boot_console.run_command('sf write %x %x %x' % (addr + total_size, old_size, size))
+ assert expected_write in output
+ with u_boot_console.temporary_timeout(timeout):
+ output = u_boot_console.run_command('sf read %x %x %x' % (addr + total_size + offset, old_size, size))
+ assert expected_read in output
output = u_boot_console.run_command('crc32 %x %x' % (addr + total_size + offset, size))
assert expected_crc32 in output
old_size = size
expected_crc32 = m.group(1)
# print expected_crc32
+ timeout = 10000000
old_size = 0
for size in random.randint(4, page_size), random.randint(page_size, total_size), total_size:
+ size = size & ~3
size = size - old_size
- output = u_boot_console.run_command('sf write %x %x %x' % (addr + 0x10000 + old_size, old_size, size))
- assert expected_write in output
+ with u_boot_console.temporary_timeout(timeout):
+ output = u_boot_console.run_command('sf write %x %x %x' % (addr + 0x10000 + old_size, old_size, size))
+ assert expected_write in output
old_size = size
- output = u_boot_console.run_command('sf read %x %x %x' % (addr + 0x10000 + total_size, 0, total_size))
- assert expected_read in output
+ with u_boot_console.temporary_timeout(timeout):
+ output = u_boot_console.run_command('sf read %x %x %x' % (addr + 0x10000 + total_size, 0, total_size))
+ assert expected_read in output
- u_boot_console.run_command('md %x' % (addr + 0x10000 + total_size))
+ #u_boot_console.run_command('md %x' % (addr + 0x10000 + total_size))
output = u_boot_console.run_command('crc32 %x %x' % (addr + 0x10000 + total_size, total_size))
assert expected_crc32 in output