⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd_zl_vga_qvga.c

📁 windows 6.0 lcd driver
💻 C
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
//
// (C) Copyright 2006 Marvell International Ltd.
// All Rights Reserved
//
/******************************************************************************
**
**  COPYRIGHT (C) 2004 Intel Corporation.
**
**  This software as well as the software described in it is furnished under
**  license and may only be used or copied in accordance with the terms of the
**  license. The information in this file is furnished for informational use
**  only, is subject to change without notice, and should not be construed as
**  a commitment by Intel Corporation. Intel Corporation assumes no
**  responsibility or liability for any errors or inaccuracies that may appear
**  in this document or any software that may be provided in association with
**  this document. 
**  Except as permitted by such license, no part of this document may be 
**  reproduced, stored in a retrieval system, or transmitted in any form or by
**  any means without the express written consent of Intel Corporation. 
**
**  FILENAME:  xllp_lcd_zl_ls037v7dw01.c
**
**  PURPOSE:   platform-specific source file for XLLP LCD controller.
**                              This file is specific for LS037V7DW01 (VGA/QVGA) on Zylonite. 
**
*******************************************************************************/

#include "lcd_plat.h"
#include "runtime_context.h"

#include "GPIO_SOC.h"
#include "GPIO_Platform.h"
#include "MFP_DRV.h"
#include "lcd_panels.h"

#define VGA_WIDTH 480
#define VGA_HEIGHT 640
#define QVGA_WIDTH 240
#define QVGA_HEIGHT 320

static void set_power_mode(active_panel_t *lcd, UINT32 power_mode);
static PXA_STATUS_T init(active_panel_t *lcd);
static PXA_STATUS_T  post_init(active_panel_t *lcd);

active_panel_t qvga_ls037 = 
{
    set_power_mode,
    init,
    post_init,

    // configuration
    {
        QVGA_WIDTH,
        QVGA_HEIGHT,
		16,
        // timing
        {
            0x27,   /* BLW */
            0x28,   /* ELW */
            0x3,    /* HSW */
            0x2,    /* BFW */
            0x2,    /* EFW */
            0x0,    /* VSW */
            /* PCD */
            {
                0xe,    /* 104M */
                0x16,   /* 156M */
                0x1e,   /* 208M */
                0x4,    /* 39M */
                0x8             /* D0CS 60M */
            }
        },
        { 
            0,      /* OEP */
            1,      /* PCP */
            1,      /* HSP */
            1       /* VSP */
        }
    }
};

active_panel_t vga_ls037 = 
{
    set_power_mode,
    init,
    post_init,

    // configuration
    {
        VGA_WIDTH,
        VGA_HEIGHT,
		16,
        /* timing */
        {
            0x4f,   /* BLW */
            0x5f,   /* ELW */
            0x3,    /* HSW */
            0x2,    /* BFW */
            0x6,    /* EFW */
            0x0,    /* VSW */
            /* PCD */
            {
                //    The set of values derivd from the formula
                //  will cause slightly over drive of the LCD which
                //  lead to lighter dots on the screen. Here we 
                //  adjust the devider a little bigger to archive 
                //  better display effect under VGA mode.
                //      0x3,            /* 104M */
                //      0x4,            /* 156M */
                //      0x7,            /* 208M */
                //      0x1,            /* 39M */
                //      0x2                     /* D0CS */
                0x5,            /* 104M */
                0x7,            /* 156M */
                0xa,            /* 208M */
                0x1,            /* 39M */
                0x3                     /* D0CS */
            }
        },
        { 
            0,      /* OEP */
            1,      /* PCP */
            1,      /* HSP */
            1       /* VSP */
        }
    }
};


static BOOL panel_is_leaded = 1;
static PXA_GPIOREG_T *gpio_regs;



static PXA_STATUS_T init(active_panel_t* panel)
{
    PXA_STATUS_T status = PXA_STATUS_SUCCESS;
    PXA_LEVEL_T mode_pin_level;
     
    mode_pin_level = panel->config.width == VGA_WIDTH? PXA_HI : PXA_LO;

    // mode pin level is reverted for lead free panel
    if (!panel_is_leaded)
         mode_pin_level = mode_pin_level == PXA_HI? PXA_LO : PXA_HI;

    MFP_SetActiveMode(PXA_COMPONENT_LCD_ID);
    // GPIO registers can't be retained after wakeup
    PXA_GPIOSetDirection(gpio_regs, PXA_GPIO_LCD_LDD_17_ID, PXA_GPIO_DIRECTION_OUT);
    PXA_GPIOSetDirection(gpio_regs, PXA_GPIO_LCD_VSYNC_ID, PXA_GPIO_DIRECTION_OUT);
    // select active lcd instead of oled
    PXA_GPIOSetLevel(gpio_regs, PXA_GPIO_LCD_LDD_17_ID, PXA_LO);
    PXA_GPIOSetLevel(gpio_regs, PXA_GPIO_LCD_VSYNC_ID, mode_pin_level);
    return status;      
}

static PXA_STATUS_T post_init(active_panel_t* lcd)
{
	return PXA_STATUS_SUCCESS;
}

static void set_power_mode(active_panel_t* panel, UINT32 power_mode)
{
    set_lcd_domain(power_mode);
    //if (power_mode == FALSE)
    //    PXA_GPIOSetLevel(gpio_regs, PXA_GPIO_LCD_VSYNC_ID, PXA_LO);
}

active_panel_t* vga_qvga_panel_init(BOOL is_vga, BOOL is_leaded)
{
    active_panel_t *panel;

	gpio_regs = (PXA_GPIOREG_T*)PXA_CTX_GetRegAddr(PXA_PERIPHERAL_REGIDX_GPIO);

    if (is_vga)
        panel = &vga_ls037;
    else
        panel = &qvga_ls037;

    panel_is_leaded = is_leaded;

    if (!is_leaded)
    {
        qvga_ls037.config.timing.BLW = 0x14;
        qvga_ls037.config.timing.EFW = 0x3;
        vga_ls037.config.timing.EFW = 0x5;
    }
    return panel;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -