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

📄 panel.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
📖 第 1 页 / 共 2 页
字号:
//  *****************************************************************************
//
//              PANEL Module provides display panel output function.
//              1.      NOW, it supports WIBBOND NEC, PANASONIC, ROHM and NJU VFD controller.
//              2.      ALL controlling procedures about these controllers are put
//                      in "VFD_CTRL.H" including :
//                              PANEL_Initial(), _Hardware_CTRL(), PANEL_KeyScan(),
//                              _InByteVFD(), _OutByteVFD, and _LightVFD_LED().
//              3.      If the VFD controller is same as any one above, users need
//                      to revise PANEL.H only. If users want to develop a new VFD
//                      controller PANEL.H & VFD_CTRL.H both need to be revised.
//  -----------------------------------------------------------------------------
//              Version 2.00  For Panel ( gerenal version )
//  -----------------------------------------------------------------------------
//              Copyright (c) 2000, Cheertek Corp. All rights reserved.
//
//  *****************************************************************************

#include "winav.h"
#include "fmanager.h"
/*
#ifndef SYSTEM_8051
#define NO_PANEL
#endif
*/
#include "cc.h"
#include "cdinfo.h"
#include "osd.h"
#include "panel.h"
#include "input.h"
#include "hal.h"
#include "navigate.h"
#include "digest.h"

// ** TCH.277a; begin... 
#ifdef EXT_IO
BYTE    __sbVFDcs;
BYTE    __sbVFDsck;
#endif  // #ifdef   EXT_IO
// ** TCH.277a; end... 

BYTE _bPanelTemp1, _bPanelTemp2;

// LLY.160, some important thing for modification:
// [1] Rename _bOSDMode to _bOSDAppMode, and OSD_MODE_XXX to OSD_APPMODE_XXX

// Micky2.78+one_cpu
// Declare variables only when PANEL ias defined.
#ifndef NO_PANEL
BYTE    _bDisplayRam[VFD_GRID_ARRAY];
BYTE    _bLettTimeMessage[VFD_LETTNUM];
BYTE    *_bLettArray=NULL;
BYTE    _bSetupMenu = NULL;

#ifdef  LIGHT_LED
        BYTE    IDATA _bLedData = 0;
#endif
extern BYTE __bAngle;                   // For ANGLE showing flag
extern BIT __btInputProgram;    // For program showing flag
extern BYTE __bACHN;                    // For 5.1 CHANNEL showing flag
extern  STATUS gcShowStatus;
#endif  //#ifndef NO_PANEL

char    code aNumMap[]
        = { NUM_0, NUM_1, NUM_2, NUM_3, NUM_4, NUM_5, NUM_6, NUM_7, NUM_8, NUM_9};
char    code aMessageOpen[]
        = {0, LETT_O, LETT_P, LETT_E, LETT_N};
char    code aMessageClose[]
        = {LETT_C, LETT_L, LETT_O, LETT_S, LETT_E};
char    code aMessageLoading[]
        = {0, LETT_L, LETT_O, LETT_A, LETT_d};
char    code aMessageNoDisc[]
        = {LETT_N, LETT_O, LETT_d, LETT_S, LETT_C};
char    code aMessageStop[]
        = {0, LETT_S, LETT_t, LETT_O, LETT_P};
char    code aMessagePlaying[]
        = {0, LETT_P, LETT_L, LETT_A, LETT_Y};
char    code aMessagePreStop[]
        = {LETT_P, LETT_S, LETT_t, LETT_O, LETT_P};
char    code aMessageSetup[]
        = {LETT_S, LETT_E, LETT_t, LETT_U, LETT_P};
char    code aMessagePbc[]
        = {0, LETT_P, LETT_b, LETT_c, 0};
char    code aMessageUpgrade[]
        = {0, NUM_1, LETT_o, LETT_r, NUM_2};
char    code aMessageDigest[]
        = {LETT_I, LETT_n, LETT_t, LETT_r, LETT_o};

void    _ShowTime ( WORD wTime);        // ** TCH0.50;
void    _LightCircle();
void    _LETT_To_DisplayRam(void);
void    _Updata_System_Status(void);
void    _Repair_System_Status(void);
void    _Show_Program_Message(void);
void    _Show_GotoTime_Message(void);
void    _Show_Search_Message(void);
#include "VFD_CTRL.h"

//  ***************************************************************************
//  Function    :   PANEL_Trigger
//  Abstract    :   Update the value of ( MIN:SEC ) on panel
//  Arguments   :   wTime
//  Return      :   none
//  ***************************************************************************
void PANEL_Trigger(WORD wTime)
{
#ifndef NO_PANEL
    extern BIT __btPlaying;
    extern BYTE __bSetupMode;

    if((__btInputProgram)||(__bSearchMode!=SEARCH_MODE_OFF)||(__bSetupMode))
        return ;

    if(__btDIGEST)
    {
        _bLettArray = aMessageDigest;
        _LETT_To_DisplayRam();
        _Hardware_CTRL();
    }
    else if((__btPlaying)||(__btPause))
    {
        _ShowTime(gcShowStatus.wCurrentTime);
        _LightCircle();
        _Updata_System_Status();
        _Repair_System_Status();
        _Hardware_CTRL();
    }
#endif
}

//  ***************************************************************************
//  Function    :   _Repair_System_Status
//  Abstract    :   _ShowTime function will clear the bit at LETTER byte(8888 8:88:88)
//                                      so will repair the loss System Status.
//  Arguments   :   none
//  Return      :   none
//  ***************************************************************************
void _Repair_System_Status(void)
{
#ifndef NO_PANEL
    if(__bAGL_Ns)
        _bDisplayRam[VFD_ANGLE_ADDR] |= VFD_ANGLE;
    if(__btProgram)
        _bDisplayRam[VFD_PGM_ADDR] |= VFD_PGM;
    if(__wDiscType & BOOK_DVD)
        _bDisplayRam[VFD_DIGITAL_ADDR] |= VFD_DIGITAL;
#endif
}

//  ***************************************************************************
//  Function    :   PANEL_Output
//  Abstract    :   Display the information according to bMessage and wParam.
//  Arguments   :   bMessage : Specifies the behavior of panel display.
//                  wParam : some bMessage use it !!
//  Return      :   none
//  Side Effect :

//  ***************************************************************************
#pragma NOAREGS
void PANEL_Output(BYTE bMessage, WORD wParam)
{
#ifndef NO_PANEL
    extern BYTE  __bTitle;
    extern WORD  __wChapter;
    extern BYTE  __bTrackNO;
    extern BYTE __bPageNO;
    extern BYTE __bSetupMode;
    extern BYTE _bOSDAppMode;

#ifdef  SHOW_LOADING_STATUS
    // don't clear all LED light
    if ( (bMessage==MSG_WAITING) && (wParam == OSD_SERVO_STABLE) )
    {
        for(_bPanelTemp1=0;_bPanelTemp1<VFD_GRID_ARRAY;_bPanelTemp1++)
            _bDisplayRam[_bPanelTemp1] = 0x00;
    }
    else
#endif
    {
        for(_bPanelTemp1=0;_bPanelTemp1<VFD_GRID_ARRAY;_bPanelTemp1++)
            _bDisplayRam[_bPanelTemp1] = 0x00;
#ifdef LIGHT_LED
        _bLedData = 0xFF;
#endif
    }
    if(gcShowStatus.bPowerDown)
    {
        HAL_WriteGPIO(GPIO_GREEN_LED_LO);
        HAL_WriteGPIO(GPIO_RED_LED_HI);
#ifdef LIGHT_LED
        _bLedData = 0x00;
#endif
        _bLettArray = aMessageLoading;  // Prepare power on show "LOAD dISC" message
        goto HARDWARE_CTRL;
    }
    else
    {
        if(__wW99AVGPCRLow & GPIO_LED_OUTPUT)
        {
            HAL_WriteGPIO(GPIO_GREEN_LED_HI);
            HAL_WriteGPIO(GPIO_RED_LED_LO);
        }
    }

    if(_bOSDAppMode == OSD_APPMODE_GAME)
    {
        _bDisplayRam[VFD_CS_ALL_ADDR] |= VFD_CS_ALL;  // Modify by HCC
        goto HARDWARE_CTRL;
    }
    if((__wDiscType & BOOK_SVCD)||(__wDiscType & BOOK_CVD)||(__wDiscType & BOOK_VCD))
    {
        if(__wPlayItem > 999)
            _bLettArray = aMessagePbc;
    }

    if((bMessage == MSG_OPEN)||(bMessage == MSG_STOP))
    {
        __bSearchMode = 0;                              // System will clear __bSearchMode while do KEY_OPEN or KEY_STOP action
    }
    if(__btInputProgram)                               // Show program message:
    {
           //for DVD program Sunny 1.00b
        _Show_Program_Message();                // like: P 01  008
    }
    if(bMessage == MSG_CLEARPROGRAM)
    {
        if((__bModeCmd == KEY_STOP)&&(_bLettArray!=aMessageLoading))
            _bLettArray = aMessageStop;                   //HLHAN1.01A END
    }
    if(__bSearchMode==SEARCH_MODE_TITLE_CHAPTER)                              // DVD search two mode show
    {                                                                   // 1. Title Chapter Search
        _Show_Search_Message();                 // 2. GotoTime Search
    }
    else if(__bSearchMode==SEARCH_MODE_TIME)                               // CD/VCD/SVCD goto time show
    {
        _Show_GotoTime_Message();
    }
    else
    {
        switch(bMessage)                                // Show LETTER message
        {                                                               // like StOP,LOAD dISC,PLAY, OPEN
            case MSG_OPEN:                          // NO dISC
                if(wParam)
                    _bLettArray = aMessageOpen;
                else if(_bSetupMenu==0)    //to avoid show LOAD DISC in setup mode; LHsu.104
                    _bLettArray = aMessageLoading;
                break;
            case MSG_CHECKLOADER:
            case MSG_WAITING:
                _bLettArray = aMessageLoading;
                break;
            case MSG_DISCTYPE:
                if(__wDiscType == NO_DISC_IN_DRIVE)
                    _bLettArray = aMessageNoDisc;
                break;
            case MSG_STOP:
                _bLettArray = aMessageStop;
                break;
            case MSG_PLAYING:
                if( _bLettArray!= _bLettTimeMessage)
                    _bLettArray = aMessagePlaying;
                break;
            case MSG_AUTOUPGRADE:
                _bLettArray = aMessageUpgrade;
                break;
            case MSG_DIGESTNUMBER:
                _bLettArray = _bLettTimeMessage;
                _bLettArray[0] = 0;
                _bLettArray[1] = 0;
                if(__bPageNO)
                {
                    _bLettArray[2] = 0;
                    if(__wDiscType & VCD_2_0)
                    {
                        _bLettArray[3] = aNumMap[__bTrackNO-__bPageNO *9 -1];
                    }
                    else
                    {
                        _bLettArray[3] = aNumMap[__bTrackNO-__bPageNO];
                    }
                }
                else
                {
                    if(__wDiscType & VCD_2_0)
                    {
                        _bLettArray[2] = aNumMap[(__bTrackNO -1)/10];
                        _bLettArray[3] = aNumMap[(__bTrackNO-1)%10];
                    }
                    else
                    {
                        _bLettArray[2] = aNumMap[__bTrackNO/10];
                        _bLettArray[3] = aNumMap[__bTrackNO%10];
                    }
                }
                _bLettArray[4] = 0;
                break;
        }
    }
    if(_bOSDAppMode == OSD_APPMODE_SETUP)
    {
        if(!_bSetupMenu)
        {
            _bSetupMenu = 1;
            if(_bLettArray == aMessageOpen)
                _bSetupMenu = 2;
            else if(_bLettArray == aMessageNoDisc)
                _bSetupMenu = 3;
            _bLettArray = aMessageSetup;
            if(_bSetupMenu > 1)
            {
                _LETT_To_DisplayRam();
                goto HARDWARE_CTRL;
            }
        }
    }
    else if(_bSetupMenu)
    {
        if(__bModeCmd == KEY_STOP)
        {
            switch(_bSetupMenu)
            {
                case 1:
                    _bLettArray = aMessageStop;
                    break;
                case 2:
                    _bLettArray = aMessageOpen;
                    break;
                case 3:
                    _bLettArray = aMessageNoDisc;
                    break;
            }
        }
        _bSetupMenu = NULL;
    }
// Micky2.79, tune the usage of __bCountStop, don't reference DOUBLE_STOP
// Only DOUBLE_STOP is defined, the value will be 1(pre-stop)
//#ifdef DOUBLE_STOP
    if((_bLettArray == aMessageStop)&&(__bCountStop == 1 ))
        _bLettArray = aMessagePreStop;
//#endif

// Micky.051 for debugging usage ...
    if(bMessage==MSG_VERSION)
    {
        _bLettArray = _bLettTimeMessage;
        _bLettArray[4] = aNumMap[wParam%10];
        wParam/=10;
        _bLettArray[3] = aNumMap[wParam%10];
        wParam/=10;
        _bLettArray[2] = aNumMap[wParam%10];
        wParam/=10;
        _bLettArray[1] = aNumMap[wParam%10];
        wParam/=10;
        _bLettArray[0] = aNumMap[wParam%10];
    }
    // Sunny add for 1.02A
    if(bMessage == MSG_ERRCODE)
    {
        _bLettArray = _bLettTimeMessage;
        _bLettArray[4] = aNumMap[wParam%10];
        wParam/=10;
        _bLettArray[3] = aNumMap[wParam%10];
        wParam/=10;
        _bLettArray[2] = aNumMap[wParam%10];
        wParam/=10;
        _bLettArray[1] = aNumMap[wParam%10];
        wParam/=10;
        _bLettArray[0] = aNumMap[wParam%10];
    }
    _LETT_To_DisplayRam();                  // build Letter to DisplayRam

    if((_bLettArray != aMessageOpen)&&(_bLettArray!=aMessageNoDisc))
    {
        _LightCircle();
        if((_bLettArray != aMessageLoading))
            _Updata_System_Status();
    }
HARDWARE_CTRL:
    _Hardware_CTRL();
 #endif  // ifndef NO_PANEL
}

//  ***************************************************************************
//  Function    :   _Updata_System_Status
//  Abstract    :   Display the information according to system status.
//  Arguments   :   noe.
//  Return      :   none
//  Side Effect :
//  ***************************************************************************
#pragma NOAREGS
void _Updata_System_Status(void)
{
#ifndef NO_PANEL
//---- Disctype DVD CD VCD MP3 SVCD ----------------------------------------
    if(__wDiscType & BOOK_DVD )
    {
        _bDisplayRam[VFD_DVD_ADDR] |= VFD_DVD;
        if(__bSearchMode!=SEARCH_MODE_TIME)
        {
            _bDisplayRam[VFD_TITLE_ADDR] |= VFD_TITLE;
            _bDisplayRam[VFD_CHAPTER_ADDR] |= VFD_CHAPTER;
        }
    }
    else if(__wDiscType & BOOK_CDDA)
    {
        _bDisplayRam[VFD_CD_ADDR]  |= VFD_CD;
    }

⌨️ 快捷键说明

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