int DisplayDemoRun(DisplayCtrl *dispPtr) { char userInput = 0; int nextFrame = 0; while (userInput != 'q') { DisplayDemoPrintMenu(dispPtr); /* Store the first character in the UART recieve FIFO and echo it */ userInput = getchar(); xil_printf("%c", userInput); switch (userInput) { case '1': DisplayDemoChangeRes(dispPtr); break; case '2': nextFrame = dispPtr->curFrame + 1; if (nextFrame >= DISPLAY_NUM_FRAMES) { nextFrame = 0; } DisplayChangeFrame(dispPtr, nextFrame); break; case '3': DisplayDemoPrintTest(dispPtr->vframePtr[dispPtr->curFrame], dispPtr->vMode.width, dispPtr->vMode.height, dispPtr->stride, DISPLAYDEMO_PATTERN_0); break; case '4': DisplayDemoPrintTest(dispPtr->vframePtr[dispPtr->curFrame], dispPtr->vMode.width, dispPtr->vMode.height, dispPtr->stride, DISPLAYDEMO_PATTERN_1); break; case '5': DisplayDemoInvertFrame(dispPtr->vframePtr[dispPtr->curFrame], dispPtr->vframePtr[dispPtr->curFrame], dispPtr->vMode.width, dispPtr->vMode.height, dispPtr->stride); break; case '6': nextFrame = dispPtr->curFrame + 1; if (nextFrame >= DISPLAY_NUM_FRAMES) { nextFrame = 0; } DisplayDemoInvertFrame(dispPtr->vframePtr[dispPtr->curFrame], dispPtr->vframePtr[nextFrame], dispPtr->vMode.width, dispPtr->vMode.height, dispPtr->stride); DisplayChangeFrame(dispPtr, nextFrame); break; case 'q': break; default : xil_printf("\n\rInvalid Selection"); { struct timespec ts; ts.tv_sec = 0; ts.tv_nsec = 500000000; nanosleep( &ts, NULL ); } } } return XST_SUCCESS; }
int DisplayDemoInitialize(DisplayCtrl *dispPtr, u16 vdmaId, u32 dispCtrlAddr, int fHdmi, u32 *vframePtr[DISPLAY_NUM_FRAMES], u32 *pframePtr[DISPLAY_NUM_FRAMES]) { int Status; Status = DisplayInitialize(dispPtr, vdmaId, dispCtrlAddr, fHdmi, vframePtr, pframePtr, DISPLAYDEMO_STRIDE); if (Status != XST_SUCCESS) { xil_printf("Display Ctrl initialization failed during demo initialization%d\r\n", Status); return XST_FAILURE; } Status = DisplayStart(dispPtr); if (Status != XST_SUCCESS) { xil_printf("Couldn't start display during demo initialization%d\r\n", Status); return XST_FAILURE; } DisplayDemoPrintTest(dispPtr->vframePtr[dispPtr->curFrame], dispPtr->vMode.width, dispPtr->vMode.height, dispPtr->stride, DISPLAYDEMO_PATTERN_1); return XST_SUCCESS; }
int DisplayDemoRun(DisplayCtrl *dispPtr, u32 uartAddr) { char userInput = 0; int nextFrame = 0; /* Flush UART FIFO */ while (XUartPs_IsReceiveData(uartAddr)) { XUartPs_ReadReg(uartAddr, XUARTPS_FIFO_OFFSET); } while (userInput != 'q') { DisplayDemoPrintMenu(dispPtr); /* Wait for data on UART */ while (!XUartPs_IsReceiveData(uartAddr)) {} /* Store the first character in the UART recieve FIFO and echo it */ userInput = XUartPs_ReadReg(uartAddr, XUARTPS_FIFO_OFFSET); xil_printf("%c", userInput); switch (userInput) { case '1': DisplayDemoChangeRes(dispPtr, uartAddr); break; case '2': nextFrame = dispPtr->curFrame + 1; if (nextFrame >= DISPLAY_NUM_FRAMES) { nextFrame = 0; } DisplayChangeFrame(dispPtr, nextFrame); break; case '3': DisplayDemoPrintTest(dispPtr->framePtr[dispPtr->curFrame], dispPtr->vMode.width, dispPtr->vMode.height, dispPtr->stride, DISPLAYDEMO_PATTERN_0); break; case '4': DisplayDemoPrintTest(dispPtr->framePtr[dispPtr->curFrame], dispPtr->vMode.width, dispPtr->vMode.height, dispPtr->stride, DISPLAYDEMO_PATTERN_1); break; case '5': DisplayDemoInvertFrame(dispPtr->framePtr[dispPtr->curFrame], dispPtr->framePtr[dispPtr->curFrame], dispPtr->vMode.width, dispPtr->vMode.height, dispPtr->stride); break; case '6': nextFrame = dispPtr->curFrame + 1; if (nextFrame >= DISPLAY_NUM_FRAMES) { nextFrame = 0; } DisplayDemoInvertFrame(dispPtr->framePtr[dispPtr->curFrame], dispPtr->framePtr[nextFrame], dispPtr->vMode.width, dispPtr->vMode.height, dispPtr->stride); DisplayChangeFrame(dispPtr, nextFrame); break; case 'q': break; default : xil_printf("\n\rInvalid Selection"); TimerDelay(500000); } } return XST_SUCCESS; }