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

📄 osdfunc.c

📁 很难得的最好的rtd3523系列原厂源码LCD驱动开发
💻 C
📖 第 1 页 / 共 3 页
字号:
//----------------------------------------------------------------------------------------------------
// ID Code      : OsdFunc.c No.0001
// Update Note  : 
//
//----------------------------------------------------------------------------------------------------

#define __OSDFX__

#include "..\Header\Include.h"


//----------------------------------------------------------------------------------------------------
// OSD Basic Functions
//----------------------------------------------------------------------------------------------------

//--------------------------------------------------
// Description  : 
// Input Value  : 
// Output Value : 
//--------------------------------------------------
void COsdFxEnableOsd(void)
{
    CTimerWaitForEvent(_EVENT_DEN_STOP);

    CScalerSetBit(_OVERLAY_CTRL_6C, ~_BIT0, _BIT0);	

	//x.hu, green led only start up with OSD
	#if (_CUSTOM_TYPE == _CUSTOM_HAOZHEN)
	LED_Message_HaoZhen(LED_MSG_GREEN);
	#endif
}

//--------------------------------------------------
// Description  : 
// Input Value  : 
// Output Value : 
//--------------------------------------------------
void COsdFxDisableOsd(void)
{
    CTimerWaitForEvent(_EVENT_DEN_STOP);
    CScalerSetBit(_OVERLAY_CTRL_6C, ~_BIT0, 0x00);

	bValueAdj = _FALSE;
	
	SETOSDSTATE(_MENU_NONE);
						
	SETOSDITEM0(_ITEM_NONE);
	SETOSDITEM1(_ITEM_NONE);

	//x.hu, green led only start up with OSD
	#if (_CUSTOM_TYPE == _CUSTOM_HAOZHEN)
	LED_Message_HaoZhen(LED_MSG_BLACK);
	#endif
	
	// x.hu, add for no signal osd show
	// reactive no signal window to show again, and go to power saving mode
	if (ucModeFound>7) {
		if (GET_OSDPAGE_AT_NOSIGNAL() == _TRUE)
		{
			#if(_TMDS_SUPPORT == _ON)
			if(bVGACONNECT && bDVICONNECT)
			#else
			if(bVGACONNECT)
			#endif
			{
				#if (_OSD_NOSIGNAL_OPTION == _TRUE)
				CTimerReactiveTimerEvent(SEC(3.5), CModeNoCableEvent);
				CTimerActiveTimerEvent(SEC(6), CModePowerSavingEvent);
				#else
				//CTimerReactiveTimerEvent(SEC(3.5), CModeNoCableEvent);
				CTimerActiveTimerEvent(SEC(5), CModePowerSavingEvent);
				#endif
			}
			else
			{
				#if (_OSD_NOSIGNAL_OPTION == _TRUE)
				CTimerReactiveTimerEvent(SEC(3.5), CModeNoSignalEvent);
				CTimerActiveTimerEvent(SEC(6), CModePowerSavingEvent);
				#else
				//CTimerReactiveTimerEvent(SEC(3.5), CModeNoSignalEvent);
				CTimerActiveTimerEvent(SEC(5), CModePowerSavingEvent);
				#endif
			}

			CLR_OSDPAGE_AT_NOSIGNAL();
		}
	}

}


//--------------------------------------------------
// Description  : 
// Input Value  : 
// Output Value : 
//--------------------------------------------------
void COsdFxCloseWindow(BYTE ucWinNumber)
{
    pData[0]    = 0x81;
    pData[1]    = (BYTE)(ucWinNumber * 4+3);
    pData[2]    = 0x00;
    CScalerWrite(_OSD_ADDR_MSB_90, 3, pData, _AUTOINC);
}

//--------------------------------------------------
// Description  : 
// Input Value  : 
// Output Value : 
//--------------------------------------------------
void COsdFxSlider(BYTE ucRow, BYTE ucCol, BYTE ucLength, WORD usValue, WORD usMax, WORD usMin)
{
    BYTE cnt;

    usValue  = usValue - usMin;
    pData[0] = _L_BAR;

    for(cnt=1;cnt<(ucLength - 1);cnt++)
        pData[cnt] = _0_BAR;

    pData[ucLength - 1] = _R_BAR;

    cnt =((WORD)(usValue * (ucLength - 2))) / (usMax - usMin);

    if(cnt < (ucLength - 2))
        pData[cnt + 1] = (_0_BAR) + (((((WORD)(usValue * (ucLength - 2))) * _SLIDER_RESOLUTION) / (usMax - usMin)) % _SLIDER_RESOLUTION);

    for(;cnt>0;cnt--)
        pData[cnt] = _0_BAR + _SLIDER_RESOLUTION - 1;

    COsdFxCalcStartAddress(ucRow, ucCol, _WRITE_BYTE1);
    CScalerWrite(_OSD_DATA_PORT_92, ucLength, pData, _NON_AUTOINC);
}

//--------------------------------------------------
// Description  : 
// Input Value  : 
//                ucPar:
//                bit 0 (Align left or right)   [ 0: Align left     1: Align right	      ]
//                bit 1 (Force to show number)  [ 0: Disable        1: Enable             ]
//                bit 4 ~ 6 (Show numbers)      [ 0 ~ 7: Show 1 ~ 8 numbers               ]
// Output Value : 
//--------------------------------------------------
void COsdFxShowNumber(BYTE ucRow, BYTE ucCol, WORD usValue, BYTE ucPar)
{
    BYTE index, temp, i;

    pData[4] = (_0_ + (usValue/10000));
    pData[3] = (_0_ + (usValue%10000)/1000);
    pData[2] = (_0_ + (usValue%1000)/100);
    pData[1] = (_0_ + (usValue%100)/10);
    pData[0] = (_0_ + (usValue%10));

	for(index=0;index<5;index++)
	{
		if(pData[4 - index] != ((bit)(ucPar & _BIT1) ? 0x00 : _0_))
		{
			index = 4 - index;
			break;
		}
	}

	if((bit)(ucPar & _BIT1))
    {
        temp = (ucPar & 0x70) >> 4;
		index = (ucPar & 0x70) >> 4;
    }
    else
    {
        temp = (ucPar & 0x70) >> 4;
        if(temp < index)
            temp = index;
    }

	if(usValue == 0 && !((bit)(ucPar & 0x02)) )
		index = 0;

	if((bit)(ucPar & 0x01))		// Align Right
		COsdFxCalcStartAddress(ucRow, ucCol - temp, _WRITE_BYTE1);
	else						// Align Left
		COsdFxCalcStartAddress(ucRow, ucCol, _WRITE_BYTE1);

	for(i=0;i<=temp;i++)
    {
        if(index >= temp)
        {
    		pData[i + 8] = pData[index - i];
        }
        else
        {
            if(i < (temp - index))
                pData[i + 8] = 0x00;
            else
        		pData[i + 8] = pData[index - (i - (temp - index))];
        }
    }

    CScalerWrite(_OSD_DATA_PORT_92, (temp + 1), &pData[8], _NON_AUTOINC);

    //return temp + 1;
}

/*
//--------------------------------------------------
// Description  : 
// Input Value  : 
// Output Value : 
//--------------------------------------------------
void COsdFxShowNorm100Number(BYTE ucRow, BYTE ucCol, WORD usValue, WORD usMax, WORD usMin, BYTE ucPar)
{
    usValue = ((LWORD)(usValue - usMin) * 100) / (usMax - usMin);

    COsdFxShowNumber(ucRow, ucCol, usValue, ucPar);
}
*/

/*
//--------------------------------------------------
// Description  : 
// Input Value  : 
// Output Value : 
//--------------------------------------------------
void COsdFxCodeWrite(BYTE code *pArray)
{
    BYTE cnt, temp;

    CScalerWrite(_OSD_ADDR_MSB_90, 2, pArray, _AUTOINC);
    pArray += 2;

    cnt = 0;

    while(_TRUE)
    {
        if(*pArray == _EXT_)
        {
            CScalerWrite(_OSD_DATA_PORT_92, cnt, pArray - cnt, _NON_AUTOINC);
            cnt = 0;

            if(*(pArray + 1) > 3)
                return;

            temp = _EXT_ + *(pArray + 1);

            if(*(pArray + 2) == _REPEAT_)
            {
                CScalerWriteAmount(_OSD_DATA_PORT_92, *(pArray + 3), temp, _NON_AUTOINC);
                pArray += 4;
            }
            else
            {
                CScalerWrite(_OSD_DATA_PORT_92, 1, &temp, _NON_AUTOINC);
                pArray += 2;
            }
        }
        else if(*pArray == _REPEAT_)
        {
            CScalerWrite(_OSD_DATA_PORT_92, cnt, pArray - cnt, _NON_AUTOINC);

            CScalerWriteAmount(_OSD_DATA_PORT_92, *(pArray + 1) - 1, *(pArray - 1), _NON_AUTOINC);

            pArray += 2;
            cnt = 0;
        }
        else if(*pArray == _NEXT_)
        {
            CScalerWrite(_OSD_DATA_PORT_92, cnt, pArray - cnt, _NON_AUTOINC);
            pArray++;
            cnt = 0;

            if(*(pArray + 1) != _END_)
            {
                CScalerWrite(_OSD_ADDR_MSB_90, 2, pArray, _AUTOINC);
                pArray += 2;
            }
            else
            {
                break;
            }
        }
        else if(*(pArray) == _END_)
        {
            CScalerWrite(_OSD_DATA_PORT_92, cnt, pArray - cnt, _NON_AUTOINC);
            break;
        }
        else
        {
            pArray++;
            cnt++;
        }
    }
}
*/
//version 200D
/*
//--------------------------------------------------
// Description  : 
// Input Value  : 
// Output Value : 
//--------------------------------------------------
void COsdFxShowNorm100Number(BYTE ucRow, BYTE ucCol, WORD usValue, WORD usMax, WORD usMin, BYTE ucPar)
{
    usValue = ((LWORD)(usValue - usMin) * 100) / (usMax - usMin);

    COsdFxShowNumber(ucRow, ucCol, usValue, ucPar);
}
*/
//--------------------------------------------------
// Description  : 
// Input Value  : 
// Output Value : 
//--------------------------------------------------
void COsdFxCodeWrite(BYTE code *pArray)
{
    BYTE cnt, temp;

    CScalerWrite(_OSD_ADDR_MSB_90, 2, pArray, _AUTOINC);
    pArray += 2;

    cnt = 0;

    while(_TRUE)
    {
        if(*pArray == _EXT_)
        {
            CScalerWrite(_OSD_DATA_PORT_92, cnt, pArray - cnt, _NON_AUTOINC);
            cnt = 0;

            if(*(pArray + 1) > 3)
                return;

            temp = _EXT_ + *(pArray + 1);

            if(*(pArray + 2) == _REPEAT_)
            {
                CScalerWriteAmount(_OSD_DATA_PORT_92, *(pArray + 3), temp, _NON_AUTOINC);
                pArray += 4;
            }
            else
            {
                CScalerWrite(_OSD_DATA_PORT_92, 1, &temp, _NON_AUTOINC);
                pArray += 2;
            }
        }
        else if(*pArray == _REPEAT_)
        {
            CScalerWrite(_OSD_DATA_PORT_92, cnt, pArray - cnt, _NON_AUTOINC);

            CScalerWriteAmount(_OSD_DATA_PORT_92, *(pArray + 1) - 1, *(pArray - 1), _NON_AUTOINC);

            pArray += 2;
            cnt = 0;
        }
        else if(*pArray == _NEXT_)
        {
            CScalerWrite(_OSD_DATA_PORT_92, cnt, pArray - cnt, _NON_AUTOINC);
            pArray++;
            cnt = 0;

            if(*(pArray) != _END_)
            {
                CScalerWrite(_OSD_ADDR_MSB_90, 2, pArray, _AUTOINC);
                pArray += 2;
            }
            else
            {
                break;
            }
        }
        else if(*(pArray) == _END_)
        {
            CScalerWrite(_OSD_DATA_PORT_92, cnt, pArray - cnt, _NON_AUTOINC);
            break;

⌨️ 快捷键说明

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