tests/ports/rp2/rp2_dma.py: Tweak test to be more reliable.
The timing of the DMA transfer can vary a bit, so tweak the allowed values. Also test the return value of `rp2.DMA.irq.flags()` to make sure the IRQ is correctly signalled. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
807c25d05a
commit
2d7fb9a715
@ -62,7 +62,7 @@ dma.write = dest
|
|||||||
dma.count = len(dest) // 4
|
dma.count = len(dest) // 4
|
||||||
dma.ctrl = dma.pack_ctrl()
|
dma.ctrl = dma.pack_ctrl()
|
||||||
dt = run_and_time_dma(dma)
|
dt = run_and_time_dma(dma)
|
||||||
print(60 <= dt <= 90)
|
print(70 <= dt <= 110)
|
||||||
print(dest[:8], dest[-8:])
|
print(dest[:8], dest[-8:])
|
||||||
dma.close()
|
dma.close()
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ dma.close()
|
|||||||
print("# test irq")
|
print("# test irq")
|
||||||
dest = bytearray(1024)
|
dest = bytearray(1024)
|
||||||
dma = rp2.DMA()
|
dma = rp2.DMA()
|
||||||
dma.irq(lambda _: print("irq fired"))
|
dma.irq(lambda dma: print("irq fired", dma.irq().flags()))
|
||||||
dma.config(
|
dma.config(
|
||||||
read=src, write=dest, count=len(dest) // 4, ctrl=dma.pack_ctrl(irq_quiet=0), trigger=True
|
read=src, write=dest, count=len(dest) // 4, ctrl=dma.pack_ctrl(irq_quiet=0), trigger=True
|
||||||
)
|
)
|
||||||
|
@ -12,5 +12,5 @@ bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07') bytearray(b'\xf8\xf9\xfa\xfb\xfc\
|
|||||||
# test immediate trigger
|
# test immediate trigger
|
||||||
bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07') bytearray(b'\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff')
|
bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07') bytearray(b'\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff')
|
||||||
# test irq
|
# test irq
|
||||||
irq fired
|
irq fired 1
|
||||||
bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07') bytearray(b'\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff')
|
bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07') bytearray(b'\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user