/** * * Main function that invokes the GPIO Interrupt example. * * @param None. * * @return * - XST_SUCCESS if the example has completed successfully. * - XST_FAILURE if the example has failed. * * @note None. * *****************************************************************************/ int main(void) { int Status; xil_printf("GPIO Interrupt Example Test \r\n"); /* * Run the GPIO interrupt example, specify the parameters that * are generated in xparameters.h. */ Status = GpioIntrExample(&Intc, &Gpio, GPIO_DEVICE_ID, GPIO_INTERRUPT_ID); if (Status != XST_SUCCESS) { xil_printf("GPIO Interrupt Example Test Failed\r\n"); return XST_FAILURE; } xil_printf("Successfully ran GPIO Interrupt Example Test\r\n"); return XST_SUCCESS; }
int main(void) { int Status; u32 DataRead; print(" Press button to Generate Interrupt\r\n"); Status = GpioIntrExample(&Intc, &Gpio, GPIO_DEVICE_ID, INTC_GPIO_INTERRUPT_ID, GPIO_CHANNEL1, &DataRead); if (Status == 0 ) { if(DataRead == 0) print("No button pressed. \r\n"); else print("Gpio Interrupt Test PASSED. \r\n"); } else { print("Gpio Interrupt Test FAILED.\r\n"); } }
int main() { static XIntc intc; static XGpio dip_switches_4bits_Gpio; static XTmrCtr axi_timer_0_Timer; Xil_ICacheEnable(); Xil_DCacheEnable(); print("---Entering main---\n\r"); { int status; print("\r\n Running IntcSelfTestExample() for microblaze_0_intc...\r\n"); status = IntcSelfTestExample(XPAR_MICROBLAZE_0_INTC_DEVICE_ID); if (status == 0) { print("IntcSelfTestExample PASSED\r\n"); } else { print("IntcSelfTestExample FAILED\r\n"); } } { int Status; Status = IntcInterruptSetup(&intc, XPAR_MICROBLAZE_0_INTC_DEVICE_ID); if (Status == 0) { print("Intc Interrupt Setup PASSED\r\n"); } else { print("Intc Interrupt Setup FAILED\r\n"); } } { int status; print("\r\nRunning UartLiteSelfTestExample() for debug_module...\r\n"); status = UartLiteSelfTestExample(XPAR_DEBUG_MODULE_DEVICE_ID); if (status == 0) { print("UartLiteSelfTestExample PASSED\r\n"); } else { print("UartLiteSelfTestExample FAILED\r\n"); } } /* * Peripheral SelfTest will not be run for usb_uart * because it has been selected as the STDOUT device */ { u32 status; print("\r\nRunning GpioInputExample() for dip_switches_4bits...\r\n"); u32 DataRead; status = GpioInputExample(XPAR_DIP_SWITCHES_4BITS_DEVICE_ID, &DataRead); if (status == 0) { xil_printf("GpioInputExample PASSED. Read data:0x%X\r\n", DataRead); } else { print("GpioInputExample FAILED.\r\n"); } } { int Status; u32 DataRead; print(" Press button to Generate Interrupt\r\n"); Status = GpioIntrExample(&intc, &dip_switches_4bits_Gpio, \ XPAR_DIP_SWITCHES_4BITS_DEVICE_ID, \ XPAR_MICROBLAZE_0_INTC_DIP_SWITCHES_4BITS_IP2INTC_IRPT_INTR, \ GPIO_CHANNEL1, &DataRead); if (Status == 0 ){ if(DataRead == 0) print("No button pressed. \r\n"); else print("Gpio Interrupt Test PASSED. \r\n"); } else { print("Gpio Interrupt Test FAILED.\r\n"); } } { u32 status; print("\r\nRunning GpioOutputExample() for leds_4bits...\r\n"); status = GpioOutputExample(XPAR_LEDS_4BITS_DEVICE_ID,4); if (status == 0) { print("GpioOutputExample PASSED.\r\n"); } else { print("GpioOutputExample FAILED.\r\n"); } } { int status; print("\r\nRunning EmacLitePolledExample() for ethernet_mac...\r\n"); status = EmacLitePolledExample(XPAR_ETHERNET_MAC_DEVICE_ID); if (status == 0) { print("EmacLite Polled Example PASSED\r\n"); } else { print("EmacLite Polled Example FAILED\r\n"); } } { int status; print("\r\n Running TmrCtrSelfTestExample() for axi_timer_0...\r\n"); status = TmrCtrSelfTestExample(XPAR_AXI_TIMER_0_DEVICE_ID, 0x0); if (status == 0) { print("TmrCtrSelfTestExample PASSED\r\n"); } else { print("TmrCtrSelfTestExample FAILED\r\n"); } } { int Status; print("\r\n Running Interrupt Test for axi_timer_0...\r\n"); Status = TmrCtrIntrExample(&intc, &axi_timer_0_Timer, \ XPAR_AXI_TIMER_0_DEVICE_ID, \ XPAR_MICROBLAZE_0_INTC_AXI_TIMER_0_INTERRUPT_INTR, 0); if (Status == 0) { print("Timer Interrupt Test PASSED\r\n"); } else { print("Timer Interrupt Test FAILED\r\n"); } } { XStatus status; print("\r\n Runnning SpiSelfTestExample() for spi_flash...\r\n"); status = SpiSelfTestExample(XPAR_SPI_FLASH_DEVICE_ID); if (status == 0) { print("SpiSelfTestExample PASSED\r\n"); } else { print("SpiSelfTestExample FAILED\r\n"); } } print("---Exiting main---\n\r"); Xil_DCacheDisable(); Xil_ICacheDisable(); return 0; }
int main() { static XScuGic intc; static XEmacPs ps7_ethernet_0; static XGpio axi_btn_Gpio; static XScuTimer ps7_scutimer_0; static XScuWdt ps7_scuwdt_0; Xil_ICacheEnable(); Xil_DCacheEnable(); print("---Entering main---\n\r"); { int Status; print("\r\n Running ScuGicSelfTestExample() for ps7_scugic_0...\r\n"); Status = ScuGicSelfTestExample(XPAR_PS7_SCUGIC_0_DEVICE_ID); if (Status == 0) { print("ScuGicSelfTestExample PASSED\r\n"); } else { print("ScuGicSelfTestExample FAILED\r\n"); } } { int Status; Status = ScuGicInterruptSetup(&intc, XPAR_PS7_SCUGIC_0_DEVICE_ID); if (Status == 0) { print("ScuGic Interrupt Setup PASSED\r\n"); } else { print("ScuGic Interrupt Setup FAILED\r\n"); } } { u32 status; print("\r\nRunning GpioOutputExample() for axi_led...\r\n"); status = GpioOutputExample(XPAR_AXI_LED_DEVICE_ID,4); if (status == 0) { print("GpioOutputExample PASSED.\r\n"); } else { print("GpioOutputExample FAILED.\r\n"); } } { int Status; print("\r\n Running DcfgSelfTestExample() for ps7_dev_cfg_0...\r\n"); Status = DcfgSelfTestExample(XPAR_PS7_DEV_CFG_0_DEVICE_ID); if (Status == 0) { print("DcfgSelfTestExample PASSED\r\n"); } else { print("DcfgSelfTestExample FAILED\r\n"); } } { int Status; print("\r\n Running XDmaPs_Example_W_Intr() for ps7_dma_s...\r\n"); Status = XDmaPs_Example_W_Intr(&intc,XPAR_PS7_DMA_S_DEVICE_ID); if (Status == 0) { print("XDmaPs_Example_W_Intr PASSED\r\n"); } else { print("XDmaPs_Example_W_Intr FAILED\r\n"); } } { int Status; print("\r\n Running Interrupt Test for ps7_ethernet_0...\r\n"); Status = EmacPsDmaIntrExample(&intc, &ps7_ethernet_0, \ XPAR_PS7_ETHERNET_0_DEVICE_ID, \ XPAR_PS7_ETHERNET_0_INTR); if (Status == 0) { print("EmacPsDmaIntrExample PASSED\r\n"); } else { print("EmacPsDmaIntrExample FAILED\r\n"); } } { int Status; print("\r\n Running IicPsSelfTestExample() for ps7_i2c_0...\r\n"); Status = IicPsSelfTestExample(XPAR_PS7_I2C_0_DEVICE_ID); if (Status == 0) { print("IicPsSelfTestExample PASSED\r\n"); } else { print("IicPsSelfTestExample FAILED\r\n"); } } { int Status; print("\r\n Running QspiSelfTestExample() for ps7_qspi_0...\r\n"); Status = QspiPsSelfTestExample(XPAR_PS7_QSPI_0_DEVICE_ID); if (Status == 0) { print("QspiPsSelfTestExample PASSED\r\n"); } else { print("QspiPsSelfTestExample FAILED\r\n"); } } { u32 status; print("\r\nRunning GpioInputExample() for axi_btn...\r\n"); u32 DataRead; status = GpioInputExample(XPAR_AXI_BTN_DEVICE_ID, &DataRead); if (status == 0) { xil_printf("GpioInputExample PASSED. Read data:0x%X\r\n", DataRead); } else { print("GpioInputExample FAILED.\r\n"); } } { int Status; u32 DataRead; print(" Press button to Generate Interrupt\r\n"); Status = GpioIntrExample(&intc, &axi_btn_Gpio, \ XPAR_AXI_BTN_DEVICE_ID, \ XPAR_FABRIC_AXI_BTN_IP2INTC_IRPT_INTR, \ GPIO_CHANNEL1, &DataRead); if (Status == 0 ){ if(DataRead == 0) print("No button pressed. \r\n"); else print("Gpio Interrupt Test PASSED. \r\n"); } else { print("Gpio Interrupt Test FAILED.\r\n"); } } { int Status; print("\r\n Running ScuTimerPolledExample() for ps7_scutimer_0...\r\n"); Status = ScuTimerPolledExample(XPAR_PS7_SCUTIMER_0_DEVICE_ID); if (Status == 0) { print("ScuTimerPolledExample PASSED\r\n"); } else { print("ScuTimerPolledExample FAILED\r\n"); } } { int Status; print("\r\n Running Interrupt Test for ps7_scutimer_0...\r\n"); Status = ScuTimerIntrExample(&intc, &ps7_scutimer_0, \ XPAR_PS7_SCUTIMER_0_DEVICE_ID, \ XPAR_PS7_SCUTIMER_0_INTR); if (Status == 0) { print("ScuTimerIntrExample PASSED\r\n"); } else { print("ScuTimerIntrExample FAILED\r\n"); } } { int Status; print("\r\n Running Interrupt Test for ps7_scuwdt_0...\r\n"); Status = ScuWdtIntrExample(&intc, &ps7_scuwdt_0, \ XPAR_PS7_SCUWDT_0_DEVICE_ID, \ XPAR_PS7_SCUWDT_0_INTR); if (Status == 0) { print("ScuWdtIntrExample PASSED\r\n"); } else { print("ScuWdtIntrExample FAILED\r\n"); } } { int Status; print("\r\n Running SpiPsSelfTestExample() for ps7_spi_1...\r\n"); Status = SpiPsSelfTestExample(XPAR_PS7_SPI_1_DEVICE_ID); if (Status == 0) { print("SpiPsSelfTestExample PASSED\r\n"); } else { print("SpiPsSelfTestExample FAILED\r\n"); } } /* * Peripheral Test will not be run for ps7_uart_1 * because it has been selected as the STDOUT device */ print("---Exiting main---\n\r"); Xil_DCacheDisable(); Xil_ICacheDisable(); return 0; }