1*** Variables *** 2${PROJECT_URL} https://dl.antmicro.com/projects/renode 3 4${PLATFORM} platforms/cpus/cortex-a53-gicv3.repl 5${ZEPHYR-BIN} ${PROJECT_URL}/cortex-a53--zephyr-pl330-dma_loop_tests.elf-s_70008-bdfc1e055c0dc33dbc846d085bab60e1cdd33352 6 7${LINUX-SCRIPT} scripts/single-node/zedboard.resc 8${LINUX-BIN} ${PROJECT_URL}/zynq--pl330-dmatest-vmlinux-s_15041432-5c3eb414a72bb23cc7bc425163945a5a8f9f10b5 9# This DT is modified for peripheral transfer tests - it inserts STM USART that is not normally available for this platform 10# and connects it to the DMA Controller, using `dmas` property of the USART's node, to test peripheral to memory DMA transfers 11${LINUX-DTB} ${PROJECT_URL}/zynq--pl330-dmatest-devicetree.dtb-s_12003-4d13125ea98eaafb4df8854dc43b2dbb31a5bac2 12${LINUX-ROOTFS} ${PROJECT_URL}/zynq--pl330-dmatest-vmlinux-rootfs.ext2-s_16777216-335b589cf4048764907362ec668c29db88644ffc 13${PROMPT} \#${SPACE} 14 15${UART} sysbus.uart0 16 17*** Keywords *** 18Create Zephyr Machine 19 Execute Command mach create 20 Execute Command machine LoadPlatformDescription @${PLATFORM} 21 Execute Command machine LoadPlatformDescriptionFromString "dma_program_memory: Memory.MappedMemory @ sysbus 0x93B0000 { size: 0x10000 }" 22 Execute Command machine LoadPlatformDescriptionFromString "dma: DMA.PL330_DMA @ sysbus 0x9300000" 23 Execute Command sysbus LoadELF @${ZEPHYR-BIN} 24 25 Create Terminal Tester ${UART} defaultPauseEmulation=True 26 27*** Test Cases *** 28Should Pass Zephyr DMA Loop Transfer Test 29 Create Zephyr Machine 30 31 Wait For Line On Uart I: Device pl330@9300000 initialized 32 33 Wait For Line On Uart PASS - test_test_dma0_m2m_loop 34 Wait For Line On Uart PASS - test_test_dma0_m2m_loop_repeated_start_stop 35 36 Wait For Line On Uart PROJECT EXECUTION SUCCESSFUL 37 38Should Initialize Linux Driver 39 Execute Command set bin @${LINUX-BIN} 40 Execute Command set rootfs @${LINUX-ROOTFS} 41 Execute Command set dtb @${LINUX-DTB} 42 Execute Command include @${LINUX-SCRIPT} 43 # This is needed for peripheral transfer tests - it occupies unused address 44 # channels 2 and 3 are reserved by USART's driver, and shouldn't be used otherwise 45 Execute Command machine LoadPlatformDescriptionFromString "st_dma_uart: UART.STM32F7_USART @ sysbus 0x4000e000 { frequency: 200000000; IRQ -> gic@55; ReceiveDmaRequest -> dma_pl330@2 }" 46 47 Create Terminal Tester ${UART} defaultPauseEmulation=True 48 49 # Make sure the driver initializes 50 Wait For Line On Uart dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-341330 51 52 # Wait for Linux to boot up and log into the shell 53 Wait For Prompt On Uart buildroot login: timeout=25 54 Write Line To Uart root 55 Wait For Prompt On Uart ${PROMPT} 56 57 Provides booted-linux 58 59Should Pass Linux Dmatest 60 Requires booted-linux 61 62 # It seems like the shell or tty splits long lines, so disable echo 63 Write Line To Uart modprobe dmatest timeout=2000 iterations=5 threads_per_chan=4 channel=dma0chan0 channel=dma0chan1 run=1 waitForEcho=false 64 65 Wait For Line On Uart dmatest: Started 4 threads using dma0chan0 66 Wait For Line On Uart dmatest: Started 4 threads using dma0chan1 67 68 Wait For Line On Uart dmatest: dma\\dchan\\d-copy\\d: summary 5 tests, 0 failures includeUnfinishedLine=true treatAsRegex=true 69 Wait For Line On Uart dmatest: dma\\dchan\\d-copy\\d: summary 5 tests, 0 failures includeUnfinishedLine=true treatAsRegex=true 70 Wait For Line On Uart dmatest: dma\\dchan\\d-copy\\d: summary 5 tests, 0 failures includeUnfinishedLine=true treatAsRegex=true 71 Wait For Line On Uart dmatest: dma\\dchan\\d-copy\\d: summary 5 tests, 0 failures includeUnfinishedLine=true treatAsRegex=true 72 Wait For Line On Uart dmatest: dma\\dchan\\d-copy\\d: summary 5 tests, 0 failures includeUnfinishedLine=true treatAsRegex=true 73 Wait For Line On Uart dmatest: dma\\dchan\\d-copy\\d: summary 5 tests, 0 failures includeUnfinishedLine=true treatAsRegex=true 74 Wait For Line On Uart dmatest: dma\\dchan\\d-copy\\d: summary 5 tests, 0 failures includeUnfinishedLine=true treatAsRegex=true 75 Wait For Line On Uart dmatest: dma\\dchan\\d-copy\\d: summary 5 tests, 0 failures includeUnfinishedLine=true treatAsRegex=true 76 77Should Perform Peripheral To Memory Transfer 78 Requires booted-linux 79 80 # This test uses artificially inserted STM32 USART to trigger transfer using its DMA driver API 81 # raw mode forces TTY to print character by character without waiting for new line 82 Write Line To Uart stty -F /dev/ttySTM2 raw 83 Wait For Prompt On Uart ${PROMPT} 84 85 Write Line To Uart cat /dev/ttySTM2 & 86 # USART needs to be woken up and rx channel activated by the driver - give it some time 87 # this delay is practically invisible in an interactive flow 88 Write Line To Uart sleep 1 89 Wait For Prompt On Uart ${PROMPT} 90 91 Execute Command st_dma_uart WriteLine "DMATEST" 92 93 # If DMA works correctly, the same string will be printed on stdout 94 Wait For Line On Uart DMATEST includeUnfinishedLine=true 95