1*** Variables *** 2${SCRIPT} ${CURDIR}/../../scripts/single-node/gr712rc.resc 3${UART} sysbus.uart0 4${GPIO_BIN} @https://dl.antmicro.com/projects/renode/gaisler-gr712rc--custom-rtems-gpio.prom.elf-s_145444-331f2e16b35e247c296b8e637f4901a46852c5ce 5 6*** Keywords *** 7Prepare Machine 8 Execute Script ${SCRIPT} 9 10 Create Terminal Tester ${UART} defaultPauseEmulation=True 11 12Prepare Machine With Buttons And LEDs 13 [Arguments] ${bin} 14 15 Execute Command $bin = ${bin} 16 Prepare Machine 17 18 Execute Command machine LoadPlatformDescriptionFromString "buttonLowLevel1: Miscellaneous.Button @ gpio1 1 { IRQ -> gpio1@1 }" 19 Execute Command machine LoadPlatformDescriptionFromString "buttonRisingEdge: Miscellaneous.Button @ gpio1 2 { IRQ -> gpio1@2 }" 20 Execute Command machine LoadPlatformDescriptionFromString "buttonFallingEdge: Miscellaneous.Button @ gpio1 3 { IRQ -> gpio1@3 }" 21 Execute Command machine LoadPlatformDescriptionFromString "buttonHighLevel: Miscellaneous.Button @ gpio1 4 { IRQ -> gpio1@4 }" 22 Execute Command machine LoadPlatformDescriptionFromString "buttonLowLevel2: Miscellaneous.Button @ gpio1 5 { IRQ -> gpio1@5 }" 23 24 Execute Command machine LoadPlatformDescriptionFromString "led: Miscellaneous.LED @ gpio1 7; gpio1: { 7 -> led@0 }" 25 Execute Command machine LoadPlatformDescriptionFromString "ledInputOnlyPin: Miscellaneous.LED @ gpio1 8; gpio1: { 8 -> ledInputOnlyPin@0 }" 26 27 ${led}= Create LED Tester sysbus.gpio1.led 0.05 28 Set Suite Variable ${led} ${led} 29 ${ledInputOnlyPin}= Create LED Tester sysbus.gpio1.ledInputOnlyPin 0.05 30 Set Suite Variable ${ledInputOnlyPin} ${ledInputOnlyPin} 31 32*** Test Cases *** 33Should Run RTEMS Hello World with LEON3 PROM 34 Prepare Machine 35 36 Start Emulation 37 38 Wait For Line On Uart MKPROM2 boot loader v2.0.69 39 Wait For Line On Uart starting rtems-hello 40 Wait For Line On Uart Hello World over printk() on Debug console 41 42Should Run RTEMS GPIO Interrupt Sample 43 Prepare Machine With Buttons And LEDs ${GPIO_BIN} 44 45 # This low level-triggered ISR should fire continuously at first 46 Wait For Line On Uart GPIO_ISR: pin 1 47 Wait For Line On Uart GPIO_ISR: pin 1 48 Should Not Be On Uart TEST END timeout=0.005 49 50 Execute Command gpio1.buttonLowLevel1 Press 51 Wait For Line On Uart TEST END 52 53 Wait For Line On Uart Interrupts configured, ready for next test 54 55 # Rising-edge-triggered interrupt -> only once on rising edge 56 Execute Command gpio1.buttonRisingEdge Press 57 Wait For Line On Uart GPIO_ISR: pin 2 58 Assert LED State true testerId=${led} 59 # Input-only pin should not be affected 60 Assert LED State false testerId=${ledInputOnlyPin} 61 Should Not Be On Uart GPIO_ISR: pin 2 timeout=0.005 62 Execute Command gpio1.buttonRisingEdge Release 63 Should Not Be On Uart GPIO_ISR: pin 2 timeout=0.005 64 65 # Falling-edge-triggered interrupt -> only once on falling edge 66 Execute Command gpio1.buttonFallingEdge Press 67 Should Not Be On Uart GPIO_ISR: pin 3 timeout=0.005 68 Execute Command gpio1.buttonFallingEdge Release 69 Wait For Line On Uart GPIO_ISR: pin 3 70 Assert LED State false testerId=${led} 71 Assert LED State false testerId=${ledInputOnlyPin} 72 Should Not Be On Uart GPIO_ISR: pin 3 timeout=0.005 73 74 # Pressing this button enables a low-level interrupt on pin 5. That one has a higher priority so 75 # it gets printed continuously until we press the low-level button. 76 Execute Command gpio1.buttonHighLevel Press 77 Should Not Be On Uart GPIO_ISR: pin 4 timeout=0.005 78 Wait For Line On Uart GPIO_ISR: pin 5 79 Wait For Line On Uart GPIO_ISR: pin 5 80 Execute Command gpio1.buttonLowLevel2 Press 81 Wait For Line On Uart GPIO_ISR: pin 4 82 Wait For Line On Uart GPIO_ISR: pin 4 83 Should Not Be On Uart GPIO_ISR: pin 5 timeout=0.005 84 85 # Finally we release the high-level-trigger button, after which nothing should be printed 86 Execute Command pause 87 Execute Command gpio1.buttonHighLevel Release 88 Execute Command emulation RunFor "0.005" 89 Clear Terminal Tester Report 90 Should Not Be On Uart GPIO_ISR timeout=0.005 91