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

📄 drvmwe.c

📁 mstar 776 开发的车载dvd
💻 C
字号:
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2006-2007 MStar Semiconductor, Inc.
// All rights reserved.
//
// Unless otherwise stipulated in writing, any and all information contained
// herein regardless in any format shall remain the sole proprietary of
// MStar Semiconductor Inc. and be kept in strict confidence
// (¨MStar Confidential Information〃) by the recipient.
// Any unauthorized act including without limitation unauthorized disclosure,
// copying, use, reproduction, sale, distribution, modification, disassembling,
// reverse engineering and compiling of the contents of MStar Confidential
// Information is unlawful and strictly prohibited. MStar hereby reserves the
// rights to any and all damages, losses, costs and expenses resulting therefrom.
//
////////////////////////////////////////////////////////////////////////////////

#define _MSMWE_C_

#include "board.h"
#if (MWE_FUNCTION )

#include "drvMWE.h"
#include "panel.h"

#define MWE_TIMER   100

void Drv_Scaler_MWEInit( void )
{
// TODO: MWE
#if 0
    g_ucMWEStatus = 1;
    g_ucMWETimer = MWE_TIMER;
#endif
}

void Drv_Scaler_MWECtl( U8 u8Status )
{
#if 0
    U8 u8Bank;

    u8Bank = MDrv_ReadByte( BK_SELECT_00 );

    MDrv_WriteByte( BK_SELECT_00, REG_BANK_MACE );

    if( ( u8Status & MWE_MODE ) == MWE_OFF ) // Disable MWE
    {
        MDrv_WriteByte( BK_MACE_10, 0x00 );
    }
    else // Enable MWE
    {
        MDrv_WriteRegBit( BK_MACE_10 , ENABLE, 0x07 );
    }

    MDrv_WriteByte( BK_SELECT_00, u8Bank );
#endif
}

#define MWE_H_START     0
#define MWE_V_START     0
#define MWE_H_SIZE      PANEL_WIDTH/3
#define MWE_V_SIZE      PANEL_HEIGHT/3

void Drv_Scaler_MWEWindow( U8 u8Status )
{
#if 0
    U8 u8Bank;

    u8Bank = MDrv_ReadByte( BK_SELECT_00 );

    MDrv_WriteByte( BK_SELECT_00, REG_BANK_MACE );

    if( ++g_ucMWEStatus >> 3 )
        g_ucMWEStatus=0;

    u8Status=g_ucMWEStatus;

    if( ( u8Status & MWE_MODE ) == MWE_FULL_SCREEN )
    {

    }
    else if( ( u8Status & MWE_MODE ) == MWE_SIDE_BY_SIDE )
    {
        if( u8Status & MWE_SWAP ) // Side by side and Swap
        {
            MDrv_Write2Byte( BK_MACE_11, PANEL_WIDTH/2 );
            MDrv_Write2Byte( BK_MACE_13, PANEL_WIDTH );
            MDrv_Write2Byte( BK_MACE_15, 0x00 );
            MDrv_Write2Byte( BK_MACE_17, PANEL_HEIGHT );
        }
        else // Side by side
        {
            MDrv_Write2Byte( BK_MACE_11, 0x00 );
            MDrv_Write2Byte( BK_MACE_13, PANEL_WIDTH/2 );
            MDrv_Write2Byte( BK_MACE_15, 0x00 );
            MDrv_Write2Byte( BK_MACE_17, PANEL_HEIGHT );
        }
        MDrv_WriteByteMask(BK_MACE_10, 0x06, 0x07 );
    }
    else if( (u8Status&MWE_MODE) == MWE_SMALL_MOVABLE )
    {
        g_wMWE_HStart = MWE_H_START;
        g_wMWE_VStart = MWE_V_START;
        MDrv_Write2Byte(BK_MACE_11, g_wMWE_HStart);
        MDrv_Write2Byte(BK_MACE_13, g_wMWE_HStart+MWE_H_SIZE);
        MDrv_Write2Byte(BK_MACE_15, g_wMWE_VStart);
        MDrv_Write2Byte(BK_MACE_17, g_wMWE_VStart+MWE_V_SIZE);
        MDrv_WriteByteMask(BK_MACE_10, 0x06, 0x07);
    }

    MDrv_WriteByte( BK_SELECT_00, u8Bank );
#endif
}

#define MWE_H_STEP      3
#define MWE_V_STEP      2

#define MWE_H_MIN       0
#define MWE_H_MAX       PANEL_WIDTH
#define MWE_V_MIN       0
#define MWE_V_MAX       PANEL_HEIGHT

void Drv_Scaler_MWEHandler( void )
{
#if 0
    U8 u8Bank;

    if( (MWE_SMALL_MOVABLE != GetMWEMode() && MWE_SIDE_BY_SIDE !=GetMWEMode() )
        || ( !IsMWEMove() ) )
        return;

    if( ( --g_ucMWETimer ) == 0 )
    {
        u8Bank = MDrv_ReadByte( BK_SELECT_00 );

        MDrv_WriteByte( BK_SELECT_00, REG_BANK_MACE );

        g_ucMWETimer = MWE_TIMER;
        if( IsMoveRight() )
        {
            if( (g_wMWE_HStart + MWE_H_SIZE + MWE_H_STEP) > MWE_H_MAX )
            {
                g_wMWE_HStart = MWE_H_MAX - MWE_H_SIZE;
                g_ucMWEStatus &= ~MOVE_RIGHT;
            }
            else
            {
                g_wMWE_HStart += MWE_H_STEP;
            }
        }
        else
        {
            if( (g_wMWE_HStart < MWE_H_STEP) || ((g_wMWE_HStart - MWE_H_STEP) < MWE_H_MIN) )
            {
                g_wMWE_HStart = MWE_H_MIN;
                g_ucMWEStatus &= MOVE_RIGHT;
            }
            else
            {
                g_wMWE_HStart -= MWE_H_STEP;
            }
        }
        MDrv_Write2Byte( BK_MACE_11, g_wMWE_HStart );
        MDrv_Write2Byte( BK_MACE_13, g_wMWE_HStart + MWE_H_SIZE );

        if( MWE_SMALL_MOVABLE == GetMWEMode() )
        {
            if( IsMoveDown() )
            {
                if( (g_wMWE_VStart + MWE_V_SIZE + MWE_V_STEP ) > MWE_V_MAX )
                {
                    g_wMWE_VStart -= MWE_V_STEP;
                    g_ucMWEStatus &= ~MOVE_DOWN;
                }
                else
                {
                    g_wMWE_VStart += MWE_V_STEP;
                }
            }
            else
            {
                if( (g_wMWE_VStart < MWE_V_STEP) || ((g_wMWE_VStart - MWE_V_STEP) < MWE_V_MIN) )
                {
                    g_wMWE_VStart += MWE_V_STEP;
                    g_ucMWEStatus &= MOVE_DOWN;
                }
                else
                {
                    g_wMWE_VStart -= MWE_V_STEP;
                }
            }

            MDrv_Write2Byte( BK_MACE_15, g_wMWE_VStart );
            MDrv_Write2Byte( BK_MACE_17, g_wMWE_VStart + MWE_V_SIZE );
        }

        MDrv_WriteByte( BK_SELECT_00, u8Bank );
    }
#endif
}

#endif // #if (MWE_FUNCTION == _ENABLE)

#undef _MSMWE_C_

⌨️ 快捷键说明

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