/* ** Configures raster to display image */ static void SetUpLCD(void) { /* Enable clock for LCD Module */ LCDModuleClkConfig(); LCDPinMuxSetup(); /* **Clock for DMA,LIDD and for Core(which encompasses ** Raster Active Matrix and Passive Matrix logic) ** enabled. */ RasterClocksEnable(SOC_LCDC_0_REGS); /* Disable raster */ RasterDisable(SOC_LCDC_0_REGS); /* Configure the pclk */ //RasterClkConfig(SOC_LCDC_0_REGS, 9000000, 92000000); RasterClkConfig(SOC_LCDC_0_REGS, 7833600, 150000000); /* Configuring DMA of LCD controller */ RasterDMAConfig(SOC_LCDC_0_REGS, 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 */ RasterModeConfig(SOC_LCDC_0_REGS, RASTER_DISPLAY_MODE_TFT_UNPACKED, RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED); /* Configuring the polarity of timing parameters of raster controller */ RasterTiming2Configure(SOC_LCDC_0_REGS, RASTER_FRAME_CLOCK_LOW | RASTER_LINE_CLOCK_LOW | RASTER_PIXEL_CLOCK_HIGH| RASTER_SYNC_EDGE_RISING| RASTER_SYNC_CTRL_ACTIVE| RASTER_AC_BIAS_HIGH , 0, 255); #if FIVE_INCH_LCD /* Configuring horizontal timing parameter */ RasterHparamConfig(SOC_LCDC_0_REGS, 800, 48, 40, 40); /* Configuring vertical timing parameters */ RasterVparamConfig(SOC_LCDC_0_REGS, 480, 3, 13, 29); #endif #if FOUR_INCH_LCD //NHD-4.3-ATXI#-T-1 /* Configuring horizontal timing parameter */ RasterHparamConfig(SOC_LCDC_0_REGS, 480, 4, 8, 43); /* Configuring vertical timing parameters */ RasterVparamConfig(SOC_LCDC_0_REGS, 272, 10, 4, 12); #endif RasterFIFODMADelayConfig(SOC_LCDC_0_REGS, 128); }
/* * Configures raster to display image */ static void SetUpLCD(void) { PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_LCDC, PSC_POWERDOMAIN_ALWAYS_ON, PSC_MDCTL_NEXT_ENABLE); LCDPinMuxSetup(); /* Configure backlight/power control pins */ ConfigRasterDisplayEnable(); /* disable raster */ RasterDisable(SOC_LCDC_0_REGS); /* configure the pclk */ RasterClkConfig(SOC_LCDC_0_REGS, 7833600, 150000000); /* configuring DMA of LCD controller */ RasterDMAConfig(SOC_LCDC_0_REGS, 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 */ RasterModeConfig(SOC_LCDC_0_REGS, RASTER_DISPLAY_MODE_TFT, RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED); /* frame buffer data is ordered from least to Most significant bye */ RasterLSBDataOrderSelect(SOC_LCDC_0_REGS); /* disable nibble mode */ RasterNibbleModeDisable(SOC_LCDC_0_REGS); /* configuring the polarity of timing parameters of raster controller */ RasterTiming2Configure(SOC_LCDC_0_REGS, RASTER_FRAME_CLOCK_LOW | RASTER_LINE_CLOCK_LOW | RASTER_PIXEL_CLOCK_LOW | RASTER_SYNC_EDGE_RISING| RASTER_SYNC_CTRL_ACTIVE| RASTER_AC_BIAS_HIGH , 0, 255); /* configuring horizontal timing parameter */ RasterHparamConfig(SOC_LCDC_0_REGS, DISPLAY_IMAGE_WIDTH, 41, 2, 2); /* configuring vertical timing parameters */ RasterVparamConfig(SOC_LCDC_0_REGS, DISPLAY_IMAGE_HEIGHT, 10, 3, 3); /* configuring fifo delay to */ RasterFIFODMADelayConfig(SOC_LCDC_0_REGS, 2); }
/****************************************************************************** * * * \brief This function Configures raster to display image.\n * * * * \param none * * * * \return none. * * * ******************************************************************************/ static void SetUpLCD(void) { /* Enable clock for LCD Module */ LCDModuleClkConfig(); LCDPinMuxSetup(); /* **Clock for DMA,LIDD and for Core(which encompasses ** Raster Active Matrix and Passive Matrix logic) ** enabled. */ RasterClocksEnable(SOC_LCDC_0_REGS); /* Disable raster */ RasterDisable(SOC_LCDC_0_REGS); /* Configure the pclk */ RasterClkConfig(SOC_LCDC_0_REGS, LCD_P_CLK, LCD_MODULE_CLK); /* Configuring DMA of LCD controller */ RasterDMAConfig(SOC_LCDC_0_REGS, 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 */ RasterModeConfig(SOC_LCDC_0_REGS, RASTER_DISPLAY_MODE_TFT_UNPACKED, RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED); /* Configuring the polarity of timing parameters of raster controller */ RasterTiming2Configure(SOC_LCDC_0_REGS, RASTER_FRAME_CLOCK_LOW | RASTER_LINE_CLOCK_LOW | RASTER_PIXEL_CLOCK_HIGH| RASTER_SYNC_EDGE_RISING| RASTER_SYNC_CTRL_ACTIVE| RASTER_AC_BIAS_HIGH , 0, LCD_NUM_OF_LINE_CLK); /* Configuring horizontal timing parameter */ RasterHparamConfig(SOC_LCDC_0_REGS, LCD_WIDTH, HSYNC_WIDTH, H_FRONT_PORCH, H_BACK_PORCH); /* Configuring vertical timing parameters */ RasterVparamConfig(SOC_LCDC_0_REGS, LINES_PER_PANEL, VSYNC_WIDTH, V_FRONT_PORCH, V_BACK_PORCH); RasterFIFODMADelayConfig(SOC_LCDC_0_REGS, LCDC_FIFO_DELAY); }
/** * @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); }