int main(void) { int Status; /* * Run the UartNs550 selftest example */ Status = UartNs550SelfTestExample(UART_DEVICE_ID); if (Status != XST_SUCCESS) { return XST_FAILURE; } return XST_SUCCESS; }
int main (void) { static XIntc intc; /* * Enable and initialize cache */ #if XPAR_MICROBLAZE_0_USE_ICACHE Xil_ICacheInvalidate(); Xil_ICacheEnable(); #endif #if XPAR_MICROBLAZE_0_USE_DCACHE Xil_DCacheInvalidate(); Xil_DCacheEnable(); #endif static XLlTemac Hard_Ethernet_MAC_LlTemac; static XLlDma Hard_Ethernet_MAC_LlDma; /* Initialize RS232_Uart_1 - Set baudrate and number of stop bits */ XUartNs550_SetBaud(XPAR_RS232_UART_1_BASEADDR, XPAR_XUARTNS550_CLOCK_HZ, 9600); XUartNs550_SetLineControlReg(XPAR_RS232_UART_1_BASEADDR, XUN_LCR_8_DATA_BITS); static XUartNs550 RS232_Uart_2_UartNs550; static XTmrCtr xps_timer_0_Timer; print("-- Entering main() --\r\n"); { int status; print("\r\n Running IntcSelfTestExample() for xps_intc_0...\r\n"); status = IntcSelfTestExample(XPAR_XPS_INTC_0_DEVICE_ID); if (status == 0) { print("IntcSelfTestExample PASSED\r\n"); } else { print("IntcSelfTestExample FAILED\r\n"); } } { int Status; Status = IntcInterruptSetup(&intc, XPAR_XPS_INTC_0_DEVICE_ID); if (Status == 0) { print("Intc Interrupt Setup PASSED\r\n"); } else { print("Intc Interrupt Setup FAILED\r\n"); } } { u32 status; print("\r\nRunning GpioOutputExample() for LEDs_8Bit...\r\n"); status = GpioOutputExample(XPAR_LEDS_8BIT_DEVICE_ID,8); if (status == 0) { print("GpioOutputExample PASSED.\r\n"); } else { print("GpioOutputExample FAILED.\r\n"); } } { u32 status; print("\r\nRunning GpioOutputExample() for LEDs_Positions...\r\n"); status = GpioOutputExample(XPAR_LEDS_POSITIONS_DEVICE_ID,5); if (status == 0) { print("GpioOutputExample PASSED.\r\n"); } else { print("GpioOutputExample FAILED.\r\n"); } } { u32 status; print("\r\nRunning GpioInputExample() for Push_Buttons_5Bit...\r\n"); u32 DataRead; status = GpioInputExample(XPAR_PUSH_BUTTONS_5BIT_DEVICE_ID, &DataRead); if (status == 0) { xil_printf("GpioInputExample PASSED. Read data:0x%X\r\n", DataRead); } else { print("GpioInputExample FAILED.\r\n"); } } { u32 status; print("\r\nRunning GpioInputExample() for DIP_Switches_8Bit...\r\n"); u32 DataRead; status = GpioInputExample(XPAR_DIP_SWITCHES_8BIT_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; print("\r\n Running IicSelfTestExample() for IIC_EEPROM...\r\n"); status = IicSelfTestExample(XPAR_IIC_EEPROM_DEVICE_ID); if (status == 0) { print("IicSelfTestExample PASSED\r\n"); } else { print("IicSelfTestExample FAILED\r\n"); } } /* TemacPolledExample does not support SGDMA { XStatus status; print("\r\n Running TemacPolledExample() for Hard_Ethernet_MAC...\r\n"); status = TemacPolledExample( XPAR_HARD_ETHERNET_MAC_CHAN_0_DEVICE_ID, ); if (status == 0) { print("TemacPolledExample PASSED\r\n"); } else { print("TemacPolledExample FAILED\r\n"); } } */ { XStatus Status; print("\r\nRunning TemacSgDmaIntrExample() for Hard_Ethernet_MAC...\r\n"); Status = TemacSgDmaIntrExample(&intc, &Hard_Ethernet_MAC_LlTemac, &Hard_Ethernet_MAC_LlDma, XPAR_HARD_ETHERNET_MAC_CHAN_0_DEVICE_ID, XPAR_XPS_INTC_0_HARD_ETHERNET_MAC_TEMACINTC0_IRPT_INTR, XPAR_LLTEMAC_0_LLINK_CONNECTED_DMARX_INTR, XPAR_LLTEMAC_0_LLINK_CONNECTED_DMATX_INTR); if (Status == 0) { print("Temac Interrupt Test PASSED.\r\n"); } else { print("Temac Interrupt Test FAILED.\r\n"); } } { int status; print("\r\nRunning SysAceSelfTestExample() for SysACE_CompactFlash...\r\n"); status = SysAceSelfTestExample(XPAR_SYSACE_COMPACTFLASH_DEVICE_ID); if (status == 0) { print("SysAceSelfTestExample PASSED\r\n"); } else { print("SysAceSelfTestExample FAILED\r\n"); } } /* * Peripheral SelfTest will not be run for RS232_Uart_1 * because it has been selected as the STDOUT device */ { XStatus status; print("\r\nRunning UartNs550SelfTestExample() for RS232_Uart_2...\r\n"); status = UartNs550SelfTestExample(XPAR_RS232_UART_2_DEVICE_ID); if (status == 0) { print("UartNs550SelfTestExample PASSED\r\n"); } else { print("UartNs550SelfTestExample FAILED\r\n"); } } { XStatus Status; print("\r\n Running Interrupt Test for RS232_Uart_2...\r\n"); Status = UartNs550IntrExample(&intc, &RS232_Uart_2_UartNs550, \ XPAR_RS232_UART_2_DEVICE_ID, \ XPAR_XPS_INTC_0_RS232_UART_2_IP2INTC_IRPT_INTR); if (Status == 0) { print("UartNs550 Interrupt Test PASSED\r\n"); } else { print("UartNs550 Interrupt Test FAILED\r\n"); } } { int status; print("\r\n Running TmrCtrSelfTestExample() for xps_timer_0...\r\n"); status = TmrCtrSelfTestExample(XPAR_XPS_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 xps_timer_0...\r\n"); Status = TmrCtrIntrExample(&intc, &xps_timer_0_Timer, \ XPAR_XPS_TIMER_0_DEVICE_ID, \ XPAR_XPS_INTC_0_XPS_TIMER_0_INTERRUPT_INTR, 0); if (Status == 0) { print("Timer Interrupt Test PASSED\r\n"); } else { print("Timer Interrupt Test FAILED\r\n"); } } { int status; print("\r\nRunning UartLiteSelfTestExample() for mdm_0...\r\n"); status = UartLiteSelfTestExample(XPAR_MDM_0_DEVICE_ID); if (status == 0) { print("UartLiteSelfTestExample PASSED\r\n"); } else { print("UartLiteSelfTestExample FAILED\r\n"); } } /* * Disable cache and reinitialize it so that other * applications can be run with no problems */ #if XPAR_MICROBLAZE_0_USE_DCACHE Xil_DCacheDisable(); Xil_DCacheInvalidate(); #endif #if XPAR_MICROBLAZE_0_USE_ICACHE Xil_ICacheDisable(); Xil_ICacheInvalidate(); #endif print("-- Exiting main() --\r\n"); return 0; }