int Lcd_Init(void) { //IntMasterIRQEnable(); //IntAINTCInit(); LCDAINTCConfigure(); printf("Configured Interrupt\n"); LCDBackLightEnable(); printf("Cofigured Backlight\n"); SetUpLCD(); printf("Configured LCD\n"); // Configuring the base ceiling RasterDMAFBConfig(SOC_LCDC_0_REGS, (unsigned int)image1, (unsigned int)image1 + sizeof(image1) - 2, 0); RasterDMAFBConfig(SOC_LCDC_0_REGS, (unsigned int)image1, (unsigned int)image1 + sizeof(image1) - 2, 1); // Enable End of frame0/frame1 interrupt RasterIntEnable(SOC_LCDC_0_REGS, RASTER_END_OF_FRAME0_INT | RASTER_END_OF_FRAME1_INT); // Enable raster RasterEnable(SOC_LCDC_0_REGS); }
/* ** A wrapper function which enables the End-Of-Frame interrupt of Raster. */ void LCDRasterEOFIntEnable(void) { /* Enable End of frame0/frame1 interrupt */ RasterIntEnable(SOC_LCDC_0_REGS, RASTER_END_OF_FRAME0_INT | RASTER_END_OF_FRAME1_INT); }
int main(void) { MMUConfigAndEnable(); CacheEnable(CACHE_ALL); IntMasterIRQEnable(); IntAINTCInit(); /* Initialize console for communication with the Host Machine */ ConsoleUtilsInit(); // //Delay timer setup // DelayTimerSetup(); /* Select the console type based on compile time check */ ConsoleUtilsSetType(CONSOLE_UART); ConsoleUtilsPrintf("LCDC Controller\r\n"); LCDAINTCConfigure(); LCDBackLightEnable(); SetUpLCD(); /* Configuring the base ceiling */ RasterDMAFBConfig(LCDC_INSTANCE, (unsigned int)curr_image, (unsigned int)curr_image + sizeof(image1) - 2, 0); RasterDMAFBConfig(LCDC_INSTANCE, (unsigned int)curr_image, (unsigned int)curr_image + sizeof(image1) - 2, 1); /* Enable End of frame0/frame1 interrupt */ RasterIntEnable(LCDC_INSTANCE, RASTER_END_OF_FRAME0_INT | RASTER_END_OF_FRAME1_INT); /* Enable raster */ RasterEnable(LCDC_INSTANCE); while(1) { if (curr_image == image1) { curr_image = image2; } else { curr_image = image1; } delay(5000); } }
/** * @brief LCDÄ£¿é³õʼ»¯ * @return none * @date 2013/8/8 * @note * @code * @endcode * @pre * @see */ void LCDRasterInit() { MODULE *module = modulelist+MODULE_ID_LCDC; unsigned int baseaddr = module->baseAddr; lcdCtrl.baseAddr = baseaddr; lcdCtrl.lcd_clk = module->moduleClk->fClk[0]->clockSpeedHz; const tLCD_PANEL *panel = lcd_panels + TFT_PANEL; lcdCtrl.panel = panel; lcdCtrl.activeframe = 0; lcdCtrl.contexFrame = 0; unsigned int pixsize = lcdCtrl.pixsize; unsigned int width = lcd_panels[TFT_PANEL].width; unsigned int height = lcd_panels[TFT_PANEL].height; lcdCtrl.palettesize[0] = 32; lcdCtrl.palettesize[1] = 32; lcdCtrl.framesize[0] = (unsigned int)(pixsize * width * height); lcdCtrl.framesize[1] = (unsigned int)(pixsize * width * height); lcdCtrl.palette[0] = framebuffer; lcdCtrl.frameaddr[0] = (void *)((unsigned int)framebuffer + 32); lcdCtrl.palette[1] = (void *)((unsigned int)(lcdCtrl.frameaddr[0]) + lcdCtrl.framesize[0]); lcdCtrl.frameaddr[1] = (void *)((unsigned int)lcdCtrl.palette[1] + 32); lcdCtrl.activeframe = 0; //init palette and framebuffer memcpy(lcdCtrl.palette[0],palette_32b,lcdCtrl.palettesize[0]); memcpy(lcdCtrl.palette[1],palette_32b,lcdCtrl.palettesize[1]); memset(lcdCtrl.frameaddr[0], 0, lcdCtrl.pixsize * lcdCtrl.panel->height * lcdCtrl.panel->width); memset(lcdCtrl.frameaddr[1], 0, lcdCtrl.pixsize * lcdCtrl.panel->height * lcdCtrl.panel->width); moduleEnable(MODULE_ID_LCDC); RasterClocksEnable(baseaddr); RasterAutoUnderFlowEnable(baseaddr); RasterIntEnable(baseaddr, RASTER_END_OF_FRAME0_INT | RASTER_END_OF_FRAME1_INT ); RasterDisable(baseaddr); RasterClkConfig(baseaddr, lcdCtrl.panel->pxl_clk, lcdCtrl.lcd_clk); RasterDMAConfig(baseaddr, RASTER_DOUBLE_FRAME_BUFFER, RASTER_BURST_SIZE_16, RASTER_FIFO_THRESHOLD_8, RASTER_BIG_ENDIAN_DISABLE); /* Configuring modes(ex:tft or stn,color or monochrome etc) for raster controller */ if (2 == pixsize) { RasterModeConfig(baseaddr, RASTER_DISPLAY_MODE_TFT | (LCDC_RASTER_CTRL_PLM_DATA << LCDC_RASTER_CTRL_PLM_SHIFT), RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED); } else { mdError("pixsize should equal 2"); } /* Configuring the polarity of timing parameters of raster controller */ RasterTiming2Configure(baseaddr, RASTER_FRAME_CLOCK_LOW | RASTER_LINE_CLOCK_HIGH | //RASTER_LINE_CLOCK_LOW | RASTER_PIXEL_CLOCK_HIGH | RASTER_SYNC_EDGE_RISING | RASTER_SYNC_CTRL_ACTIVE | RASTER_AC_BIAS_HIGH, 0, 255); RasterHparamConfig(baseaddr, panel->width, panel->hsw, panel->hfp, panel->hbp); RasterVparamConfig(baseaddr, panel->height, panel->vsw, panel->vfp, panel->vbp); RasterFIFODMADelayConfig(baseaddr, 128); moduleIntConfigure(MODULE_ID_LCDC); }