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

📄 bspdisplay.cpp

📁 Freescale ARM11系列CPU MX31的WINCE 5.0下的BSP
💻 CPP
字号:
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
//------------------------------------------------------------------------------
//
//  Copyright (C) 2004, Motorola Inc. All Rights Reserved
//
//------------------------------------------------------------------------------
//
//  Copyright (C) 2006, Freescale Semiconductor, Inc. All Rights Reserved.
//  THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
//  AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT
//
//------------------------------------------------------------------------------
//
//  File:  bspdisplay.cpp
//
//  Provides BSP-specific configuration routines for the Display driver.
//  Includes initialization routine for the TV out encoder chip.
//
//------------------------------------------------------------------------------
#include <windows.h>
#include <winuser.h>
#include <winuserm.h>
#include <ceddk.h>

#include "bsp.h"
#include "fs453.h"


//------------------------------------------------------------------------------
// External Functions


//------------------------------------------------------------------------------
// External Variables


//------------------------------------------------------------------------------
// Defines


//------------------------------------------------------------------------------
// Types


//------------------------------------------------------------------------------
// Global Variables


//------------------------------------------------------------------------------
// Local Variables
static PCSP_PBC_REGS g_pPBC = NULL;


//------------------------------------------------------------------------------
// Local Functions


//------------------------------------------------------------------------------
//
// Function: BSPInitializeLCD
//
// This function maps the PBC pointer that is needed later
// when enabling and disabling the LCD.
//
// Parameters:
//      None
//
// Returns:
//      TRUE if success; FALSE if failure.
//
//------------------------------------------------------------------------------
BOOL BSPInitializeLCD()
{
    PHYSICAL_ADDRESS phyAddr;

    if (g_pPBC == NULL)
    {
        phyAddr.QuadPart = BSP_BASE_REG_PA_PBC_BASE;

        // Map PBC registers to virtual address space
        g_pPBC = (PCSP_PBC_REGS) MmMapIoSpace(phyAddr, sizeof(CSP_PBC_REGS), FALSE);
        if (g_pPBC == NULL)
        {
            DEBUGMSG(1, (TEXT("%s(): MmMapIoSpace failed!\r\n"), __WFUNCTION__));
            return FALSE;
        }
    }

    return TRUE;
}

//------------------------------------------------------------------------------
//
// Function: BSPEnableLCD
//
// This function enables the Sharp display panel by turning on the
// LCD through the Peripheral Bus Controller.
//
// Parameters:
//      None
//
// Returns:
//      TRUE if success; FALSE if failure.
//
//------------------------------------------------------------------------------
BOOL BSPEnableLCD()
{
    if (g_pPBC == NULL)
    {
        return FALSE;
    }

    // Turn on LCD via PBC
    OUTREG16(&g_pPBC->BCTRL1_SET, CSP_BITFMASK(PBC_BCTRL1_SET_LCDON));

    return TRUE;
}

//------------------------------------------------------------------------------
//
// Function: BSPDisableLCD
//
// This function disables the Sharp display panel by turning on the
// LCD through the Peripheral Bus Controller.
//
// Parameters:
//      None
//
// Returns:
//      TRUE if success; FALSE if failure.
//
//------------------------------------------------------------------------------
BOOL BSPDisableLCD()
{
    if (g_pPBC == NULL)
    {
        return FALSE;
    }

    // Turn off LCD via PBC
    OUTREG16(&g_pPBC->BCTRL1_CLEAR, CSP_BITFMASK(PBC_BCTRL1_CLEAR_LCDON));

    return TRUE;
}


//------------------------------------------------------------------------------
//
// Function: BSPInitializeTVOut
//
// This function initializes the FS453 TV out encoder.
//
// Parameters:
//      None
//
// Returns:
//      TRUE if success; FALSE if failure.
//
//------------------------------------------------------------------------------
BOOL BSPInitializeTVOut(BOOL tvout_ntsc)
{
    BOOL retVal = TRUE;

    if (!Fs453Init())
    {
        retVal = FALSE;
        goto done;
    }

	if (!Fs453Configure(TVIN_COLOR_RGB, (tvout_ntsc == TRUE) ? TVOUT_MODE_NTSC : TVOUT_MODE_PAL ))
    {
        retVal = FALSE;
        goto done;
    }

    if (!Fs453DACOn(TVOUT_DAC_ALL))
    {
        retVal = FALSE;
        goto done;
    }

done:
    return retVal;
}


//------------------------------------------------------------------------------
//
// Function: BSPDeinitializeTVOut
//
// This function deinitializes the FS453 TV out encoder.
//
// Parameters:
//      None
//
// Returns:
//      TRUE if success; FALSE if failure.
//
//------------------------------------------------------------------------------
BOOL BSPDeinitializeTVOut()
{
    BOOL retVal = TRUE;

    if (!Fs453Deinit())
    {
        retVal = FALSE;
        goto done;
    }

    if (!Fs453DACOff(TVOUT_DAC_ALL))
    {
        retVal = FALSE;
        goto done;
    }

done:
    return retVal;
}

⌨️ 快捷键说明

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