Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d7fb9a

Browse files
committed
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 <[email protected]>
1 parent 807c25d commit 2d7fb9a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tests/ports/rp2/rp2_dma.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def run_and_time_dma(dma):
6262
dma.count = len(dest) // 4
6363
dma.ctrl = dma.pack_ctrl()
6464
dt = run_and_time_dma(dma)
65-
print(60 <= dt <= 90)
65+
print(70 <= dt <= 110)
6666
print(dest[:8], dest[-8:])
6767
dma.close()
6868

@@ -80,7 +80,7 @@ def run_and_time_dma(dma):
8080
print("# test irq")
8181
dest = bytearray(1024)
8282
dma = rp2.DMA()
83-
dma.irq(lambda _: print("irq fired"))
83+
dma.irq(lambda dma: print("irq fired", dma.irq().flags()))
8484
dma.config(
8585
read=src, write=dest, count=len(dest) // 4, ctrl=dma.pack_ctrl(irq_quiet=0), trigger=True
8686
)

tests/ports/rp2/rp2_dma.py.exp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07') bytearray(b'\xf8\xf9\xfa\xfb\xfc\
1212
# test immediate trigger
1313
bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07') bytearray(b'\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff')
1414
# test irq
15-
irq fired
15+
irq fired 1
1616
bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07') bytearray(b'\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff')

0 commit comments

Comments
 (0)