90后嵌入式软件开发生涯 第一篇(am335x LCD 驱动移植)

 

本文实现一个am35xskevm的uboot开机显示logo


一、从TI官网上下载裸机驱动包StarerWare 


二、在rasterDisplay.c的main中找到如下函数做以下修改:
      //Enable backlight
LCDBackLightEnable();


//set Lcd
SetUpLCD();


/* Configuring the base ceiling 
Configure the base address register with base address of the array which contain pixels of the image to be
displayed and ceiling address register with end address of the same array using API RasterDMAFBConfig()
*/
        RasterDMAFBConfig( 0x4830E000, 
 (unsigned int)image1,
 (unsigned int)image1 + sizeof(image1) - 2,
 0);


        RasterDMAFBConfig( 0x4830E000, 
 (unsigned int)image1,
 (unsigned int)image1 + sizeof(image1) - 2,
 1);


       /* Enable End of frame0/frame1 interrupt */
        RasterIntEnable(0x4830E000,(0x00000100u)|(0x00000200u));
 
        /* Enable raster */
       RasterEnable( 0x4830E000);


并找到SetUpLCD()函数。
static void SetUpLCD(void)
{
    /* Enable clock for LCD Module */ 
    LCDModuleClkConfig();


/*Pin multiplexing registers to enable LCD raster pin and a standard configuration is provided as part of the
  function LCDPinMuxSetup() in platform directory
*/
    LCDPinMuxSetup();


    /* 
    **Clock for DMA,LIDD and for Core(which encompasses
    ** Raster Active Matrix and Passive Matrix logic) 
    ** enabled.
    */
    RasterClocksEnable(LCDC_INSTANCE);


    /* Disable raster */
    RasterDisable(LCDC_INSTANCE);
    
    /* Configure the pclk 
Configure the rate at which pixel data should be output by configuring pixel clock frequency by invoking
RasterClkConfig() API
*/
    RasterClkConfig(LCDC_INSTANCE, 23040000, 192000000);


    /* Configuring DMA of LCD controller 
Configuring the DMA for single or double frame buffer ,busrst size for DMA data transfer etc is done by
invoking RasterDMAConfig() API
*/ 
    RasterDMAConfig(LCDC_INSTANCE, 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(LCDC_INSTANCE, RASTER_DISPLAY_MODE_TFT_UNPACKED,
                     RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED);




     /* Configuring the polarity of timing parameters of raster controller for example frame clock , pixel clock, line clock etc.*/
    RasterTiming2Configure(LCDC_INSTANCE, 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);


    /* Configuring horizontal timing parameter */
    RasterHparamConfig(LCDC_INSTANCE, 480, 4, 8, 43);


    /* Configuring vertical timing parameters */
    RasterVparamConfig(LCDC_INSTANCE, 272, 10, 4, 12);


/*Configure the required amount of FIFO delay by invoking RasterFIFODMADelayConfig()*/
    RasterFIFODMADelayConfig(LCDC_INSTANCE, 128);


}
以下是SetUpLCD()函数在docs目录下UserGuide_02_00_00_07.pdf中的说明:
Programing Sequence
To program the raster controller, the following sequence can be used.
• Enable clock for LCD module.
• Pin multiplexing registers to enable LCD raster pin and a standard configuration is provided as part of the
function LCDPinMuxSetup() in platform directory
• Enable Software Clock for DMA,LIDD submodule and for Core(which encompasses raster active and
passive matrix logic) by invoking RasterClocksEnable() API.
• Configure the rate at which pixel data should be output by configuring pixel clock frequency by invoking
RasterClkConfig() API.
• Configuring the DMA for single or double frame buffer ,busrst size for DMA data transfer etc is done by
invoking RasterDMAConfig() API.
• Configuring Panel type(TFT or STN) ,color display or monochrome, 1/2/4/8/16/24 bit per pixel mode (packed or
unpacked(only for 24 bit)) is done invoking RasterModeConfig()API.
• Configure the polarity of various timing parameters (for example frame clock , pixel clock, line clock etc.) used
by raster by invoking RasterTiming2Configure()
• Configure the Horizontal timing parameters and pixel per line of the raster by invoking RasterHparamConfig()
API.
• Configure the vertical timing parameters and Pixel per panel of the raster invoking RasterVparamConfigure()
API.
• Configure the required amount of FIFO delay by invoking RasterFIFODMADelayConfig()
• Configure the base address register with base address of the array which contain pixels of the image to be
displayed and ceiling address register with end address of the same array using API RasterDMAFBConfig()
• Enable End of frame 0 and 1 interrupt by invoking RasterIntEnable() API;
• Enable the Raster by inovking RasterEnable()

你可能感兴趣的:(项目文章)