void system_end(void) { clear_screen(); XTft_DisableDisplay(&g_tft); XIntc_MasterDisable(XPAR_INTC_0_BASEADDR); system_disable_caches(); microblaze_disable_interrupts(); system_stop_network(); sound_stop(); htmlParserCleanup(); }
/** * * This is the example function which performs the following operations on * the TFT device - * - Set the color values of foreground and background * - Write two characters (S) one after another * - Write a string of characters * - Draw a line and scroll the screen once * - Disable the display (The screen goes blank) * - Scroll the screen once and draw a line * - Enable the TFT display * * @param TftDeviceId is the unique Id of the device. * * @return * - XST_SUCCESS if successful. * - XST_FAILURE if unsuccessful. * * @note None. * ******************************************************************************/ int TftExample(u32 TftDeviceId) { int Status; u8 VarChar; XTft_Config *TftConfigPtr; /* * Get address of the XTft_Config structure for the given device id. */ TftConfigPtr = XTft_LookupConfig(TftDeviceId); if (TftConfigPtr == (XTft_Config *)NULL) { return XST_FAILURE; } /* * Initialize all the TftInstance members and fills the screen with * default background color. */ Status = XTft_CfgInitialize(&TftInstance, TftConfigPtr, TftConfigPtr->BaseAddress); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Wait till Vsync(Video address latch) status bit is set before writing * the frame address into the Address Register. This ensures that the * current frame has been displayed and we can display a new frame of * data. Checking the Vsync state ensures that there is no data flicker * when displaying frames in real time though there is some delay due to * polling. */ while (XTft_GetVsyncStatus(&TftInstance) != XTFT_IESR_VADDRLATCH_STATUS_MASK); /* * Change the Video Memory Base Address from default value to * a valid Memory Address and clear the screen. */ XTft_SetFrameBaseAddr(&TftInstance, TFT_FRAME_ADDR); XTft_ClearScreen(&TftInstance); /* * Initialize the variable VarChar to the value to be displayed on the * screen. * Set the foreground and background colors. */ VarChar = 'S'; XTft_SetColor(&TftInstance, FGCOLOR_VALUE, BGCOLOR_VALUE); /* * Write the character two times starting from top left corner * (i.e. origin) of screen. */ XTft_Write(&TftInstance, VarChar); XTft_Write(&TftInstance, VarChar); /* * Write a string which is displayed next to the two characters * written previously. */ Status = TftWriteString(&TftInstance, (u8*)"TFT CONTROLLER\n"); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Draw a line between the coordinates (X1,Y1) and (X2,Y2) which * displays a vertical line in white color. * Scroll the screen, so the two characters and string will be * erased on screen. */ Status = TftDrawLine(&TftInstance, X1POS, Y1POS, X2POS, Y2POS, WHITECOLOR_VALUE); if (Status != XST_SUCCESS) { return XST_FAILURE; } XTft_Scroll(&TftInstance); /* * Disable the display, the screen will be turned off. */ XTft_DisableDisplay(&TftInstance); /* * Even though the screen is turned off, we can still do operations on * video memory. * Scroll the screen. * Draw a line between the coordinates (X1 + 10,Y1) and (X2,Y2) which * is displayed at different position as X1 has some offset. */ XTft_Scroll(&TftInstance); Status = TftDrawLine(&TftInstance, X1POS + 10, Y1POS, X2POS + 10, Y2POS, WHITECOLOR_VALUE); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Enable the display. Screen will display two lines in white color. * The first line from the left of screen is slightly above the * second one indicating the scroll was successful. */ XTft_EnableDisplay(&TftInstance); return XST_SUCCESS; }