1*** Settings *** 2Library tap_helper.py # used for 'Precofingure Macos' keyword 3 4*** Variables *** 5${UART} sysbus.uart0 6${PROMPT} \#${SPACE} 7${I2C_ECHO_ADDRESS} 0x10 8${I2C_SENSOR_ADDRESS} 0x31 9${GPIO_NUMBER} 967 10${GPIO_DIRECTORY} /sys/class/gpio/gpio${GPIO_NUMBER} 11${GPIO_PERIPHERIAL} gpio.led0 12${FLASH_MOUNT} /mnt/spi_flash 13${SAMPLE_FILENAME} data.bin 14${MTD0_DEV} /dev/mtd0 15${MTD0_BLOCK_DEV} /dev/mtdblock0 16${MTD1_DEV} /dev/mtd1 17${MTD1_BLOCK_DEV} /dev/mtdblock1 18${CADENCE_XSPI_BIN} @https://dl.antmicro.com/projects/renode/zynq--cadence-xspi-vmlinux-s_14143972-449b7a25d689a4b6e2adc9ae4c3abbf375ccc70c 19${CADENCE_XSPI_ROOTFS} @https://dl.antmicro.com/projects/renode/zynq--cadence-xspi-rootfs.ext2-s_16777216-65f5f502eb4a970cb0e24b5382a524a99ed9e360 20${CADENCE_XSPI_DTB} @https://dl.antmicro.com/projects/renode/zynq--cadence-xspi.dtb-s_11045-f5e1772bb1d19234ce6f0b8ec77c2f970660c7bb 21${CADENCE_XSPI_AUTOCOMMAND_BIN} @https://dl.antmicro.com/projects/renode/zynq--cadence-xspi-vmlinux-s_14386012-ff7f3dfd09804979deca966c66127df7495c5318 22${CADENCE_XSPI_AUTOCOMMAND_ROOTFS} @https://dl.antmicro.com/projects/renode/zynq--cadence-xspi-autocommand-rootfs.ext2-s_16777216-e57483f695b8e43f7550aba5185055f675e19101 23${CADENCE_XSPI_AUTOCOMMAND_DTB} @https://dl.antmicro.com/projects/renode/zynq--cadence-xspi.dtb-s_11045-f5e1772bb1d19234ce6f0b8ec77c2f970660c7bb 24${ZYNQ_UFS_BIN} @https://dl.antmicro.com/projects/renode/zynq--linux-ufs.elf-s_14602408-e730ddd43bc5bd78d3295f4816a80f2a43832388 25${ZYNQ_UFS_ROOTFS} @https://dl.antmicro.com/projects/renode/zynq--linux-ufs-rootfs.ext2-s_16777216-d81aa7e35d2b9a00d8ee7dda34143e26a958908f 26${ZYNQ_UFS_DTB} @https://dl.antmicro.com/projects/renode/zynq--linux-ufs.dtb-s_12720-0dfc729e7c8db7b51c5eb4dfd990cee186de1442 27${ZYNQ_UFS_TEST_DISK_IMG} @https://dl.antmicro.com/projects/renode/test-fs-ext2.img-s_524288-67f5bc210d7be8905b4de4ae5d70a8a142459110 28${ZYNQ_WATCHDOG_RESET_DTB} @https://dl.antmicro.com/projects/renode/zynq--linux-watchdog-reset-on-timeout.dtb-s_12898-a3b65664ac84db801b0dad1525207f304e8a7428 29${CADENCE_XSPI_PERIPHERAL} SEPARATOR=\n 30... """ 31... xspi: SPI.Cadence_xSPI @ { 32... sysbus 0xE0102000; 33... sysbus new Bus.BusMultiRegistration { 34... address: 0xe0104000; size: 0x100; region: "auxiliary" 35... }; 36... sysbus new Bus.BusMultiRegistration { 37... address: 0xe0200000; size: 0x1000; region: "dma" 38... } 39... } 40... ${SPACE*4}IRQ -> gic@63 41... 42... xspiFlash0: SPI.Micron_MT25Q @ xspi 0 { 43... underlyingMemory: xspiFlashMemory0; 44... extendedDeviceId: 0x44 45... } 46... 47... xspiFlashMemory0: Memory.MappedMemory { 48... size: 0x2000000 49... } 50... """ 51 52${UFS_HOST_TX_REQUEST_SLOTS} 32 53${UFS_HOST_RTT_REQUESTS} 16 54${UFS_HOST_TASK_MGMT_SLOTS} 8 55 56${UFS_DEVICE_LOGICAL_UNITS} 4 57${UFS_DEVICE_LOGICAL_BLOCK_SIZE} 4096 58${UFS_DEVICE_BLOCK_COUNT} 65536 59 60${UFS_DEVICE_MANUFACTURER_NAME} "Antmicro" 61${UFS_DEVICE_PRODUCT_NAME} "RenodeUFSStorage" 62${UFS_DEVICE_SERIAL_NUMBER} "0123456789ABCDEF" 63${UFS_DEVICE_OEM_ID} "000011112222" 64${UFS_DEVICE_PRODUCT_REV_LEVEL} "0000" 65 66@{UFS_STRING_DESCRIPTORS}= ${UFS_DEVICE_MANUFACTURER_NAME} 67... ${UFS_DEVICE_PRODUCT_NAME} 68... ${UFS_DEVICE_SERIAL_NUMBER} 69... ${UFS_DEVICE_OEM_ID} 70... ${UFS_DEVICE_PRODUCT_REV_LEVEL} 71 72${DEVICE_DESCR_TYPE} 0x00 73${CONFIG_DESCR_TYPE} 0x01 74${UNIT_DESCR_TYPE} 0x02 75${INTERCONNECT_DESCR_TYPE} 0x04 76${STRING_DESCR_TYPE} 0x05 77${GEOMETRY_DESCR_TYPE} 0x07 78${POWER_DESCR_TYPE} 0x08 79${DEVICE_HEALTH_DESCR_TYPE} 0x09 80 81@{UFS_DESCR_SINGLETON_TYPES}= ${DEVICE_DESCR_TYPE} 82... ${CONFIG_DESCR_TYPE} 83... ${UNIT_DESCR_TYPE} 84... ${INTERCONNECT_DESCR_TYPE} 85... ${GEOMETRY_DESCR_TYPE} 86... ${DEVICE_HEALTH_DESCR_TYPE} 87 88${UFS_HOST_CONTROLLER_PERIPHERAL} SEPARATOR=\n 89... """ 90... ufs: Storage.UFSHostController @ sysbus 0xe0102000 91... ${SPACE*4}IRQ -> gic@29 92... ${SPACE*4}transferRequestSlots: ${UFS_HOST_TX_REQUEST_SLOTS} 93... ${SPACE*4}readyToTransferRequests: ${UFS_HOST_RTT_REQUESTS} 94... ${SPACE*4}taskManagementRequestSlots: ${UFS_HOST_TASK_MGMT_SLOTS} 95... """ 96${UFS_DEVICE_PERIPHERAL} SEPARATOR=\n 97... """ 98... ufsStorage: Storage.UFSDevice @ ufs 99... ${SPACE*4}logicalUnits: ${UFS_DEVICE_LOGICAL_UNITS} 100... ${SPACE*4}logicalBlockSize: ${UFS_DEVICE_LOGICAL_BLOCK_SIZE} 101... ${SPACE*4}blockCount: ${UFS_DEVICE_BLOCK_COUNT} 102... ${SPACE*4}manufacturerName: ${UFS_DEVICE_MANUFACTURER_NAME} 103... ${SPACE*4}productName: ${UFS_DEVICE_PRODUCT_NAME} 104... ${SPACE*4}serialNumber: ${UFS_DEVICE_SERIAL_NUMBER} 105... ${SPACE*4}oemID: ${UFS_DEVICE_OEM_ID} 106... ${SPACE*4}productRevisionLevel: ${UFS_DEVICE_PRODUCT_REV_LEVEL} 107... """ 108 109${DEFAULT_IRQ_TEST} SEPARATOR=\n 110... """ 111... led50: Miscellaneous.LED @ sysbus 112... led51: Miscellaneous.LED @ sysbus 113... led52: Miscellaneous.LED @ sysbus 114... 115... uart1: 116... ${SPACE*4}-> led50@0 117... ${SPACE*4}RxFifoEmptyIRQ -> led51@0 118... ${SPACE*4}RxFifoFullIRQ -> led52@0 119... """ 120 121*** Keywords *** 122Create Machine 123 Execute Command include @scripts/single-node/zedboard.resc 124 Execute Command machine LoadPlatformDescriptionFromString "i2cEcho: Mocks.EchoI2CDevice @ i2c0 ${I2C_ECHO_ADDRESS}" 125 Execute Command machine LoadPlatformDescriptionFromString "i2cSensor: Sensors.MAX30208 @ i2c0 ${I2C_SENSOR_ADDRESS}" 126 Execute Command machine LoadPlatformDescriptionFromString "spiFlash0: SPI.Micron_MT25Q @ spi0 0 { underlyingMemory: spi0FlashMemory; extendedDeviceId: 0x44 }; spi0FlashMemory: Memory.MappedMemory { size: 0x2000000 }" 127 Execute Command machine LoadPlatformDescriptionFromString "spiFlash1: SPI.Cypress_S25H @ spi0 1 { underlyingMemory: spi1FlashMemory }; spi1FlashMemory: Memory.MappedMemory { size: 0x4000000 }" 128 ${tester}= Create Terminal Tester ${UART} 129 RETURN ${tester} 130 131Boot And Login 132 [Arguments] ${terminalTester} 133 Wait For Line On Uart Booting Linux on physical CPU 0x0 testerId=${terminalTester} 134 Wait For Prompt On Uart buildroot login: timeout=25 testerId=${terminalTester} 135 Write Line To Uart root testerId=${terminalTester} 136 Wait For Prompt On Uart ${PROMPT} testerId=${terminalTester} 137 138Check Exit Code 139 Write Line To Uart echo $? 140 Wait For Line On Uart 0 141 Wait For Prompt On Uart ${PROMPT} 142 143Execute Linux Command 144 [Arguments] ${command} ${timeout}=5 145 Write Line To Uart ${command} 146 Wait For Prompt On Uart ${PROMPT} timeout=${timeout} 147 Check Exit Code 148 149Get Linux Elapsed Seconds 150 Write Line To Uart date +%s 151 ${date}= Wait For Line On Uart ^([0-9]+)$ treatAsRegex=true 152 Wait For Prompt On Uart ${PROMPT} 153 Check Exit Code 154 ${seconds}= Convert To Integer ${date.line} 155 RETURN ${seconds} 156 157Generate Random File 158 [Arguments] ${filename} ${size_kilobytes} 159 Execute Linux Command dd if=/dev/urandom of=./${filename} bs=1024 count=${size_kilobytes} 160 161Should Mount Flash Memory And Write File 162 [Arguments] ${mtd_dev} ${mtd_block_dev} ${mount_path} ${random_filename} 163 Execute Linux Command flash_erase --jffs2 -N ${mtd_dev} 0 0 164 Execute Linux Command mkdir ${mount_path} 165 Execute Linux Command mount -t jffs2 ${mtd_block_dev} ${mount_path} 166 Execute Linux Command cp ./${random_filename} ${mount_path} 167 168 Write Line To Uart ls --color=never -1 ${mount_path} 169 Wait For Line On Uart ${random_filename} 170 Wait For Prompt On Uart ${PROMPT} 171 Check Exit Code 172 Execute Linux Command umount ${mount_path} 173 174Should Mount Flash Memory And Compare Files 175 [Arguments] ${mtd_block_dev} ${mount_path} ${random_filename} 176 Execute Linux Command mount -t jffs2 ${mtd_block_dev} ${mount_path} 177 Execute Linux Command cmp ${mount_path}/${random_filename} ./${random_filename} 178 Execute Linux Command umount ${mount_path} 179 180Should Erase Flash Memory 181 [Arguments] ${mtd_dev} ${mtd_block_dev} ${mount_path} 182 Execute Linux Command flash_erase --jffs2 -N ${mtd_dev} 0 0 183 Execute Linux Command mount -t jffs2 ${mtd_block_dev} ${mount_path} 184 Write Line To Uart ls -1 ${mount_path} | wc -l 185 Wait For Line On Uart 0 186 Wait For Prompt On Uart ${PROMPT} 187 Check Exit Code 188 Execute Linux Command umount ${mount_path} 189 190Should Access SPI Flash Memory Via Additional Cadence xSPI 191 ${UART}= Create Machine 192 Execute Command machine LoadPlatformDescriptionFromString ${CADENCE_XSPI_PERIPHERAL} 193 Start Emulation 194 195 Boot And Login ${UART} 196 # Suppress messages from the kernel space 197 Execute Linux Command echo 0 > /proc/sys/kernel/printk 198 199 Write Line To Uart ls --color=never -1 /dev/ 200 Wait For Line On Uart mtd0 201 Wait For Prompt On Uart ${PROMPT} 202 Check Exit Code 203 204 Generate Random File ${SAMPLE_FILENAME} 5 205 206 Should Mount Flash Memory And Write File ${MTD0_DEV} ${MTD0_BLOCK_DEV} ${FLASH_MOUNT} ${SAMPLE_FILENAME} 207 Should Mount Flash Memory And Compare Files ${MTD0_BLOCK_DEV} ${FLASH_MOUNT} ${SAMPLE_FILENAME} 208 Should Erase Flash Memory ${MTD0_DEV} ${MTD0_BLOCK_DEV} ${FLASH_MOUNT} 209 210# String descriptor can be read by `ufs-utils` tool only as a raw byte array, so for the purpose of comparison 211# value passed to UFS device constructor is converted to that form using custom keyword. 212Get Raw String Descriptor 213 [Arguments] ${string} 214 ${length}= Evaluate '0x\{:02x\}'.format(len("${string}".encode('utf-16le')) + 2) 215 ${raw}= Evaluate ' '.join(r'0x{:02x}'.format(chr) for chr in bytes("${string}", 'utf-16le')) 216 ${descr}= Catenate ${length} ${STRING_DESCR_TYPE} ${raw} 217 RETURN ${descr} 218 219Map Index To Disk Letter 220 [Arguments] ${index} 221 ${letter}= Evaluate chr(97 + ${index}) 222 RETURN ${letter} 223 224*** Test Cases *** 225Should Boot And Login 226 ${UART}= Create Machine 227 Start Emulation 228 229 Boot And Login ${UART} 230 # Suppress messages from the kernel space 231 Execute Linux Command echo 0 > /proc/sys/kernel/printk 232 233 Provides logged-in 234 235Should List Expected Devices 236 Requires logged-in 237 238 Write Line To Uart ls --color=never -1 /dev/ 239 Wait For Line On Uart i2c-0 240 Wait For Line On Uart mtd0 241 Wait For Line On Uart mtd1 242 Wait For Line On Uart ttyPS0 243 Wait For Prompt On Uart ${PROMPT} 244 Check Exit Code 245 246Should Detect I2C Peripherals 247 Requires logged-in 248 249 Write Line To Uart i2cdetect -yar 0 250 Wait For Line On Uart 10: 10 -- 251 Wait For Line On Uart 30: -- 31 -- 252 Wait For Prompt On Uart ${PROMPT} 253 Check Exit Code 254 255 Write Line To Uart i2cget -y 0 0x41 256 Wait For Line On Uart No such device 257 Wait For Prompt On Uart ${PROMPT} 258 259Should Communicate With I2C Echo Peripheral 260 Requires logged-in 261 262 Write Line To Uart i2ctransfer -ya 0 w3@${I2C_ECHO_ADDRESS} 0x01 0x23 0x45 r2 263 Wait For Line On Uart 0x01 0x23 264 Wait For Prompt On Uart ${PROMPT} 265 Check Exit Code 266 267 # Very long commands are splited into many lines due to the terminal width (number of columns), which confused waitForEcho feature 268 Write Line To Uart i2ctransfer -ya 0 w20@${I2C_ECHO_ADDRESS} 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 r21 waitForEcho=false 269 Wait For Line On Uart 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x00 270 Wait For Prompt On Uart ${PROMPT} 271 Check Exit Code 272 273 # Check target monitor feature 274 Execute Linux Command i2ctransfer -ya 0 w0@${I2C_ECHO_ADDRESS} 275 276Should Communicate With MAX30208 Peripheral 277 Requires logged-in 278 279 # Write and read one register 280 Execute Linux Command i2cset -y 0 ${I2C_SENSOR_ADDRESS} 0x10 0xbe 281 Write Line To Uart i2cget -y 0 ${I2C_SENSOR_ADDRESS} 0x10 282 Wait For Line On Uart 0xbe 283 Wait For Prompt On Uart ${PROMPT} 284 Check Exit Code 285 286 # Read more bytes than I2C peripheral provides 287 Write Line To Uart i2ctransfer -ya 0 w0@${I2C_SENSOR_ADDRESS} r2 288 Wait For Line On Uart 0x00 0x00 289 Wait For Prompt On Uart ${PROMPT} 290 Check Exit Code 291 292 # Read weird number of bytes to check is FinishTransmission calling works properly 293 Write Line To Uart i2ctransfer -ya 0 w19@${I2C_SENSOR_ADDRESS} 0xff 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 r18 waitForEcho=false 294 Wait For Line On Uart 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 295 Wait For Prompt On Uart ${PROMPT} 296 Check Exit Code 297 298Should Access Micron SPI Flash Memory 299 Requires logged-in 300 Generate Random File ${SAMPLE_FILENAME} 5 301 302 Should Mount Flash Memory And Write File ${MTD0_DEV} ${MTD0_BLOCK_DEV} ${FLASH_MOUNT} ${SAMPLE_FILENAME} 303 Should Mount Flash Memory And Compare Files ${MTD0_BLOCK_DEV} ${FLASH_MOUNT} ${SAMPLE_FILENAME} 304 Should Erase Flash Memory ${MTD0_DEV} ${MTD0_BLOCK_DEV} ${FLASH_MOUNT} 305 306Should Access Cypress SPI Flash Memory 307 Requires logged-in 308 Generate Random File ${SAMPLE_FILENAME} 5 309 310 Should Mount Flash Memory And Write File ${MTD1_DEV} ${MTD1_BLOCK_DEV} ${FLASH_MOUNT} ${SAMPLE_FILENAME} 311 Should Mount Flash Memory And Compare Files ${MTD1_BLOCK_DEV} ${FLASH_MOUNT} ${SAMPLE_FILENAME} 312 Should Erase Flash Memory ${MTD1_DEV} ${MTD1_BLOCK_DEV} ${FLASH_MOUNT} 313 314Time Should Elapse 315 Requires logged-in 316 317 ${seconds_before}= Get Linux Elapsed Seconds 318 Execute Linux Command sleep 2 319 ${seconds}= Get Linux Elapsed Seconds 320 Should Be True ${seconds_before} < ${seconds} 321 322Watchdog Should Timeout 323 Requires logged-in 324 # Restore suppressed messages from the kernel space 325 Execute Linux Command echo 7 > /proc/sys/kernel/printk 326 327 # Watchdog timeout is specified with -T option. 328 # Watchdog is restarted after period specified with -t option. 329 Write Line To Uart watchdog -T 2 -t 5 -F /dev/watchdog0 330 Wait For Line On Uart cdns-wdt f8005000.watchdog: Watchdog timed out. Internal reset not enabled 331 332Watchdog Should Reset On Timeout 333 # 'reset-on-timeout' property was added to watchdog node in dts to cause internal reset on watchdog timeout. 334 # https://github.com/Xilinx/linux-xlnx/blob/c8b3583bc86352009c6ac61e2ced0e12118f8ebb/Documentation/devicetree/bindings/watchdog/cdns%2Cwdt-r1p2.yaml#L35-L39 335 Execute Command $dtb=${ZYNQ_WATCHDOG_RESET_DTB} 336 ${UART}= Create Machine 337 Boot And Login ${UART} 338 339 # Watchdog timeout is specified with -T option. 340 # Watchdog is restarted after period specified with -t option. 341 Write Line To Uart watchdog -T 2 -t 5 -F /dev/watchdog0 342 Boot And Login ${UART} 343 344Should Access SPI Flash Memory Via Additional Cadence xSPI IP 345 Execute Command $bin=${CADENCE_XSPI_BIN} 346 Execute Command $rootfs=${CADENCE_XSPI_ROOTFS} 347 Execute Command $dtb=${CADENCE_XSPI_DTB} 348 349 Should Access SPI Flash Memory Via Additional Cadence xSPI 350 351Should Access SPI Flash Memory Via Additional Cadence xSPI IP With The Auto Command Patch 352 Execute Command $bin=${CADENCE_XSPI_AUTOCOMMAND_BIN} 353 Execute Command $rootfs=${CADENCE_XSPI_AUTOCOMMAND_ROOTFS} 354 Execute Command $dtb=${CADENCE_XSPI_AUTOCOMMAND_DTB} 355 356 Should Access SPI Flash Memory Via Additional Cadence xSPI 357 358Should Boot And Login With UFS 359 Execute Command $bin=${ZYNQ_UFS_BIN} 360 Execute Command $rootfs=${ZYNQ_UFS_ROOTFS} 361 Execute Command $dtb=${ZYNQ_UFS_DTB} 362 363 ${UART}= Create Machine 364 Execute Command machine LoadPlatformDescriptionFromString ${UFS_HOST_CONTROLLER_PERIPHERAL} 365 Execute Command machine LoadPlatformDescriptionFromString ${UFS_DEVICE_PERIPHERAL} 366 367 Boot And Login ${UART} 368 # Suppress messages from the kernel space 369 Execute Linux Command echo 0 > /proc/sys/kernel/printk 370 Provides ufs-logged-in 371 372Should Access UFS Storage 373 Requires ufs-logged-in 374 375 ${MOUNT_POINT}= Set Variable /mnt 376 ${OUTPUT_LIST}= Create List 377 378 # Create filesystem and write some text to file on it 379 FOR ${i} IN RANGE 0 ${UFS_DEVICE_LOGICAL_UNITS} 380 ${DISK_LETTER}= Map Index To Disk Letter ${i} 381 ${DISK_DEVICE}= Set Variable /dev/sd${DISK_LETTER} 382 ${FILE_PATH}= Set Variable ${MOUNT_POINT}/file${DISK_LETTER} 383 Execute Linux Command mke2fs -b ${UFS_DEVICE_LOGICAL_BLOCK_SIZE} ${DISK_DEVICE} 384 Execute Linux Command mount ${DISK_DEVICE} ${MOUNT_POINT} 385 ${RANDOM_STRING}= Generate Random String 40 386 Append To List ${OUTPUT_LIST} ${RANDOM_STRING} 387 Execute Linux Command echo "${RANDOM_STRING}" > ${FILE_PATH} 388 Execute Linux Command umount ${MOUNT_POINT} 389 END 390 391 # Verify if data persists after umount/mount cycle 392 FOR ${i} IN RANGE 0 ${UFS_DEVICE_LOGICAL_UNITS} 393 ${DISK_LETTER}= Map Index To Disk Letter ${i} 394 ${DISK_DEVICE}= Set Variable /dev/sd${DISK_LETTER} 395 ${FILE_PATH}= Set Variable ${MOUNT_POINT}/file${DISK_LETTER} 396 Execute Linux Command mount ${DISK_DEVICE} ${MOUNT_POINT} 397 Write Line To Uart cat ${FILE_PATH} 398 Wait For Line On Uart ${OUTPUT_LIST}[${i}] 399 Execute Linux Command umount ${MOUNT_POINT} 400 END 401 402Should Load Disk Image For UFS Storage From File 403 Requires ufs-logged-in 404 405 ${MOUNT_POINT}= Set Variable /mnt 406 ${LOGICAL_UNIT_INDEX}= Set Variable 0 407 408 ${DISK_LETTER}= Map Index To Disk Letter ${LOGICAL_UNIT_INDEX} 409 ${DISK_DEVICE}= Set Variable /dev/sd${DISK_LETTER} 410 411 Execute Command ufs.ufsStorage LoadFromFile ${LOGICAL_UNIT_INDEX} ${ZYNQ_UFS_TEST_DISK_IMG} False 412 Execute Linux Command mount ${DISK_DEVICE} ${MOUNT_POINT} # Mounting should be successful as disk image contains valid filesystem 413 Execute Linux Command umount ${MOUNT_POINT} 414 415# ufs-utils: https://github.com/westerndigitalcorporation/ufs-utils/tree/faf0fe153547f5d02315fa82159f925f0c9daef8 416# was added to rootfs through buildroot's BR2_ROOTFS_OVERLAY configuration and is used for testing. 417Should Handle Native UFS commands 418 Requires ufs-logged-in 419 420 Write Line To Uart ufs-utils list_bsg 421 Wait For Line On Uart /dev/bsg/ufs-bsg0 422 Wait For Prompt On Uart ${PROMPT} 423 424 Write Line To Uart ufs-utils spec_version -p /dev/bsg/ufs-bsg0 425 Wait For Line On Uart 4.0 426 Wait For Prompt On Uart ${PROMPT} 427 428 # Unit Descriptors 429 FOR ${i} IN RANGE 0 ${UFS_DEVICE_LOGICAL_UNITS} 430 ${DESCR_TYPE_IDN}= Convert To Integer ${UNIT_DESCR_TYPE} 431 Write Line To Uart ufs-utils desc -t 2 -i ${i} --output_mode json -p /dev/bsg/ufs-bsg0 432 Wait For Line On Uart "bLength":45, 433 Wait For Line On Uart "bDescriptorType":${DESCR_TYPE_IDN}, 434 Wait For Line On Uart "bUnitIndex":${i}, 435 Wait For Prompt On Uart ${PROMPT} 436 END 437 438 FOR ${desc_type} IN @{UFS_DESCR_SINGLETON_TYPES} 439 ${DESCR_TYPE_IDN}= Convert To Integer ${desc_type} 440 Write Line To Uart ufs-utils desc -t ${DESCR_TYPE_IDN} --output_mode json -p /dev/bsg/ufs-bsg0 441 Wait For Line On Uart "bDescriptorType.*":${DESCR_TYPE_IDN}, treatAsRegex=true 442 Wait For Prompt On Uart ${PROMPT} 443 END 444 445 # String Descriptors 446 ${cnt}= Get length ${UFS_STRING_DESCRIPTORS} 447 ${DESCR_TYPE_IDN}= Convert To Integer ${STRING_DESCR_TYPE} 448 FOR ${i} IN RANGE 0 ${cnt} 449 ${DESCRIPTOR}= Get Raw String Descriptor "${UFS_STRING_DESCRIPTORS}[${i}]" 450 Write Line To Uart ufs-utils desc -t ${DESCR_TYPE_IDN} -i ${i} --output_mode raw -p /dev/bsg/ufs-bsg0 451 Wait For Line On Uart ${DESCRIPTOR} 452 Wait For Prompt On Uart ${PROMPT} 453 END 454 455Should Persist GPIO State 456 [Documentation] Tests whether the GPIO state persists after a change from userspace. 457 [Tags] linux uart gpio 458 Requires logged-in 459 460 # Prepare GPIO 461 Execute Linux Command echo ${GPIO_NUMBER} > /sys/class/gpio/export 462 Execute Linux Command echo out > ${GPIO_DIRECTORY}/direction 463 464 Execute Linux Command echo 1 > ${GPIO_DIRECTORY}/value 465 Write Line To Uart cat ${GPIO_DIRECTORY}/value 466 Wait For Line On Uart 1 467 468 Execute Linux Command echo 0 > ${GPIO_DIRECTORY}/value 469 Write Line To Uart cat ${GPIO_DIRECTORY}/value 470 Wait For Line On Uart 0 471 472Should Expose GPIO State 473 [Documentation] Tests whether the GPIO seen by the simulator matches Linux's view. 474 [Tags] linux uart gpio 475 Requires logged-in 476 Execute Command emulation CreateLEDTester "led0" ${GPIO_PERIPHERIAL} 477 478 # Prepare GPIO 479 Execute Linux Command echo ${GPIO_NUMBER} > /sys/class/gpio/export 480 Execute Linux Command echo out > ${GPIO_DIRECTORY}/direction 481 482 Execute Linux Command echo 1 > ${GPIO_DIRECTORY}/value 483 Execute Command led0 AssertState true 0 484 485 Execute Linux Command echo 0 > ${GPIO_DIRECTORY}/value 486 Execute Command led0 AssertState false 0 487 488Should Ping 489 [Documentation] Tests whether Ethernet works on the Zedboard platform. 490 [Tags] linux uart ethernet 491 Execute Command emulation CreateSwitch "switch" 492 493 Execute Command $name="Zedboard1" 494 Execute Command include @scripts/single-node/zedboard.resc 495 Execute Command connector Connect gem0 switch 496 ${tester1}= Create Terminal Tester ${UART} machine=Zedboard1 497 498 Execute Command $name="Zedboard2" 499 Execute Command include @scripts/single-node/zedboard.resc 500 Execute Command connector Connect gem0 switch 501 ${tester2}= Create Terminal Tester ${UART} machine=Zedboard2 502 503 Boot And Login ${tester1} 504 Boot And Login ${tester2} 505 506 Start Emulation 507 508 Write Line To Uart ifconfig eth0 up 192.168.1.1 testerId=${tester1} 509 Write Line To Uart ifconfig eth0 up 192.168.1.2 testerId=${tester2} 510 511 Write Line To Uart ping -c 5 192.168.1.2 testerId=${tester1} 512 Wait For Line On Uart 5 packets transmitted, 5 packets received, 0% packet loss testerId=${tester1} 513 Wait For Prompt On Uart ${PROMPT} testerId=${tester1} 514 515Should Ping Over TAP 516 [Tags] ethernet tap 517 Requires logged-in 518 519 Set Test Variable ${TAP_INTERFACE} tap0 520 Set Test Variable ${TAP_INTERFACE_IP} 192.0.2.1 521 Set Test Variable ${SERVER_IP} 192.0.2.2 522 523 # Prepare TAP 524 Execute Command emulation CreateSwitch "switch" 525 Execute Command emulation CreateTap "${TAP_INTERFACE}" "tap" 526 527 Preconfigure Macos tap0 ${TAP_INTERFACE_IP} 255.255.255.0 528 Network Interface Should Have Address ${TAP_INTERFACE} ${TAP_INTERFACE_IP} 529 530 Execute Command connector Connect host.tap switch 531 Execute Command connector Connect gem0 switch 532 533 Execute Linux Command ifconfig eth0 up ${SERVER_IP} 534 535 Write Line To Uart ping -c 5 ${TAP_INTERFACE_IP} 536 Wait For Line On Uart 5 packets transmitted, 5 packets received, 0% packet loss 537 538Should Pass Default Interrupt Test 539 # This test checks `DefaultInterrupt` behavior with named and unnamed GPIOs 540 541 Create Machine 542 Execute Command machine LoadPlatformDescriptionFromString ${DEFAULT_IRQ_TEST} 543 ${generic_irq_tester}= Create LED Tester sysbus.led50 defaultTimeout=0 544 ${rx_empty_tester}= Create LED Tester sysbus.led51 defaultTimeout=0 545 ${rx_full_tester}= Create LED Tester sysbus.led52 defaultTimeout=0 546 547 # Enable UART's RX/TX - so it triggers the IRQ 548 Execute Command sysbus.uart1 WriteDoubleWord 0x0 0x14 549 # Enable all interrupts 550 Execute Command sysbus.uart1 WriteDoubleWord 0x8 0xFFFFFFFF 551 552 Assert LED State true testerId=${generic_irq_tester} 553 Assert LED State true testerId=${rx_empty_tester} 554 Assert LED State false testerId=${rx_full_tester} 555