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

📄 srgb.c

📁 Sunplus 8202S source code.
💻 C
字号:
/**************************************************************************
 *                                                                        *
 *         Copyright (c) 2002 by Sunplus Technology Co., Ltd.             *
 *                                                                        *
 *  This software is copyrighted by and is the property of Sunplus        *
 *  Technology Co., Ltd. All rights are reserved by Sunplus Technology    *
 *  Co., Ltd. This software may only be used in accordance with the       *
 *  corresponding license agreement. Any unauthorized use, duplication,   *
 *  distribution, or disclosure of this software is expressly forbidden.  *
 *                                                                        *
 *  This Copyright notice MUST not be removed or modified without prior   *
 *  written consent of Sunplus Technology Co., Ltd.                       *
 *                                                                        *
 *  Sunplus Technology Co., Ltd. reserves the right to modify this        *
 *  software without notice.                                              *
 *                                                                        *
 *  Sunplus Technology Co., Ltd.                                          *
 *  19, Innovation First Road, Science-Based Industrial Park,             *
 *  Hsin-Chu, Taiwan, R.O.C.                                              *
 **************************************************************************/
/*--------------------------------------------------------------------------
|  File Name   :  srgb.c
|
|  Description :  8202 Serial RGB interface
|
|  Version     :  0.1  
| 
| 
|  Rev	Date	        Author(s)      Status & Comments
|---------------------------------------------------------------------------------
|  0.1	2005/1/5        wthsin         Creating
|--------------------------------------------------------------------------------*/
#include "config.h"
#include "global.h"
#include "macro.h"
#include "regmap.h"
#include "emuio.h"
 

#ifdef SERIAL_RGB       

#ifndef DVDRELEASE
 #define SERIAL_RGB_DBG       1
#endif

#define	D	printf("INFO: __%d__(%s:%s)\n",__LINE__,__FILE__,__FUNCTION__);

#ifndef SERIAL_RGB_DBG
 #undef printf
 #undef print_block
 #define printf(f, a...) do {} while (0)
 #define print_block(x,y) do {} while (0)
#endif

	
/**************************************************************************
 *                                                                        *
 *  Function Name: SetSRGB_MODE                                           *
 *                                                                        *
 *  Purposes:                                                             *
 *      set SerialRGB Mode                                                *                                                       
 *  Descriptions:                                                         *
 *      set SerialRGB Mode                                                *
 *  Arguments:                                                            *
 *      ModeType:                                                         *                                       
 *                 PANEL_MODE_280      0                                  *
 *                 PANEL_MODE_480      1                                  *
 *                 PANEL_MODE_528      2                                  *
 *                 PANEL_MODE_960      3                                  *
 *                 PANEL_MODE_1152     4                                  *
 *                 PANEL_MODE_1440     5                                  *
 *  Returns:                                                              *
 *      None                                                              *
 *  See also:                                                             *
 *      None                                                              *
 **************************************************************************/
void setSRGB_MODE(UINT32 ModeType) 
{
    UINT16 rgb_period,sample_seq,order_odd,order_even;
    switch(ModeType)
    {
     case PANEL_MODE_280:
                         rgb_period=4;
                         sample_seq=0x01;
                         order_odd=0;
                         order_even=2;
                         break;   
     case PANEL_MODE_480:
                         rgb_period=2;
                         sample_seq=0x01;
                         order_odd=0;
                         order_even=2;
                         break;  
     case PANEL_MODE_528:
                         rgb_period=7;
                         sample_seq=0x49;
                         order_odd=0;
                         order_even=2;
                         break;  
     case PANEL_MODE_960:
                         rgb_period=2;
                         sample_seq=0x05;
                         order_odd=0;
                         order_even=0;
                         break;  
     case PANEL_MODE_1152:
                         rgb_period=4;
                         sample_seq=0x0f;
                         order_odd=0;
                         order_even=0;
                         break; 
     case PANEL_MODE_1440:
                         rgb_period=14;
                         sample_seq=0x7FF;
                         order_odd=0;
                         order_even=0;
                         break;                                                                                   
    }    
	regs0->srgb_mode[1] = ((order_even&0x07)<<7)&((order_odd&0x07)<<4)&(rgb_period&0x0f);
	regs0->srgb_mode[2] = sample_seq;
}
/**************************************************************************
 *                                                                        *
 *  Function Name: SRGB_Output_Switch                                     *
 *                                                                        *
 *  Purposes:                                                             *
 *      Enable/Disable SRGB output                                        *
 *  Descriptions:                                                         *
 *      Enable/Disable SRGB output                                        *
 *  Arguments:                                                            *
 *      srgbonoff:                                                        *
 *                 SRGB_OFF            0                                  *
 *                 SRGB_ON             1                                  *
 *      lcd_tcon_mode:                                                    *
 *                 UPS051              0                                  * 
 *                 UPS052              1                                  *
 *  Returns:                                                              *
 *      None                                                              *
 *  See also:                                                             *
 *      None                                                              *
 **************************************************************************/
void SRGB_Output_Switch(UINT32 srgbonoff,UINT32 lcd_tcon_mode)
{
    regs0->srgb_mode[0]= (regs0->srgb_mode[0]&0xFFFC)+(lcd_tcon_mode<<1+srgbonoff); 
}	
/**************************************************************************
 *                                                                        *
 *  Function Name: setSRGB_para                                           *
 *                                                                        *
 *  Purposes:                                                             *
 *      setup SRGB parameter                                              *
 *  Descriptions:                                                         *
 *      setup SRGB parameter                                              *
 *  Arguments:                                                            *
 *      F_S(2 bit)/HV_NEG(1 bit)/CP(1 bit)/VBEN(1 bit)                    *
 *      /VBEN(1 bit)/UHEN(1 bit) (See register doc)                       *
 *  Returns:                                                              *
 *      None                                                              *
 *  See also:                                                             *
 *      None                                                              *
 **************************************************************************/
void setSRGB_para(UINT8 F_S,UINT8 HV_NEG,UINT8 CP,UINT8 VBEN,UINT8 VAEN,UINT8 UHEN)
{
    UINT16 value=0;
    value=F_S<<5 +HV_NEG<<4 +CP<<3 +VBEN<<2 +VAEN<<1 +UHEN;
    regs0->srgb_mode[0]= (regs0->srgb_mode[0]&0xFE03)+(value<<2); 
}	
/**************************************************************************
 *                                                                        *
 *  Function Name: SRGB_HV                                                *
 *                                                                        *
 *  Purposes:                                                             *
 *      setup SRGB HV parameter                                              *
 *  Descriptions:                                                         *
 *      setup SRGB HV parameter                                              *
 *  Arguments:                                                            *
 *      SRGB_V_MODE = 1	: Active vertical line number = 234               *
 *      SRGB_V_MODE = 0	: Active vertical line number = 220               *
 *      PAL_NTSC = 1	: PAL                                             *
 *      PAL_NTSC = 0	: NTSC                                            *
 *  Returns:                                                              *
 *      None                                                              *
 *  See also:                                                             *
 *      None                                                              *
 **************************************************************************/
void SRGB_HV ( UINT32 PAL_NTSC, UINT8 SRGB_V_MODE)
{	
	UINT32	Display_Period;
	UINT32	Total_V_Period;
	UINT32	SRGB_H_EDGE1_PNT;	
	
	if (SRGB_V_MODE)		Display_Period = 240;
	else		Display_Period = 220;
	
	if (PAL_NTSC)	Total_V_Period = 313;//313
	else			Total_V_Period = 262;//263
	
	////////////////////////////////////////	
	
	if (PAL_NTSC) SRGB_H_EDGE1_PNT = 311;
	else			SRGB_H_EDGE1_PNT = 260;

	UINT32		SRGB_H_EDGE2_PNT = SRGB_H_EDGE1_PNT+4;
	
	UINT32		SRGB_V_EDGE1_LT;
	if (PAL_NTSC) SRGB_V_EDGE1_LT = 27;
	else			SRGB_V_EDGE1_LT = 15;
	
	UINT32		SRGB_V_EDGE2_LT = SRGB_V_EDGE1_LT + 1;
	UINT32		SRGB_V_EDGE1_LB = SRGB_V_EDGE1_LT + Total_V_Period;
	UINT32		SRGB_V_EDGE2_LB = SRGB_V_EDGE1_LB + 1;
	
	UINT32		SRGB_V_START_LT = SRGB_V_EDGE2_LT + 3;
	UINT32		SRGB_V_END_LT = SRGB_V_START_LT + Display_Period;
	
	UINT32		SRGB_V_START_LB = SRGB_V_EDGE2_LB + 3;
	UINT32		SRGB_V_END_LB = SRGB_V_START_LB + Display_Period;	
	
	////////////////////////////////////////	
	
	regs0->tv_pccon[0] = SRGB_H_EDGE1_PNT;
	regs0->tv_pccon[1] = SRGB_H_EDGE2_PNT;
	regs0->tv_pccon[2] = SRGB_V_START_LT;
	regs0->tv_pccon[3] = SRGB_V_END_LT;
	regs0->tv_pccon[4] = SRGB_V_START_LB;
	regs0->tv_pccon[5] = SRGB_V_END_LB;
	regs0->tv_pccon[6] = SRGB_V_EDGE1_LT;
	regs0->tv_pccon[7] = SRGB_V_EDGE2_LT;
	regs0->tv_pccon[8] = SRGB_V_EDGE1_LB;							
	regs0->tv_pccon[9] = SRGB_V_EDGE2_LB;	

}
#endif    //#ifdef SERIAL_RGB 



⌨️ 快捷键说明

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