?? vp.c
字號:
/* **********************************************************************
Copyright (c) 2002-2006 Beyond Innovation Technology Co., Ltd
All rights are reserved. Reproduction in whole or in parts is
prohibited without the prior written consent of the copyright owner.
----------------------------------------------------------------------
Module: VP.C - Video Processor.
Purpose: Implementation of VP module.
Version: 0.01 11:24AM 2005/11/17
Compiler: Keil 8051 C Compiler v8.01
Reference:
[1] BIT1611B Data Sheet Version 1.0, 2005-11-10,
Beyond Innovation Technology
----------------------------------------------------------------------
Modification:
R0.01 11:24AM 2005/11/17 Jeffrey Chang
Reason:
1. Original.
Solution:
********************************************************************** */
#define _VP_C_
/* ------------------------------------
Header Files
------------------------------------ */
#include "bitek.h"
#include "led.h"
#include "timer.h"
#include "vp.h"
#include "yuv.h"
#if (PROJECT == DMO04041000) || \
(PROJECT == DMO04042500) || \
(PROJECT == DMO04052500)
#include "i2c.h"
#endif
#if (PROJECT == DMO04015800)
#include "spi.h"
#endif
/* ------------------------------------
Macro Definitions
------------------------------------ */
// in MS
#define COLORSTD_STABLE_TIME 30
// in MS
#define COLORSTD_SETUP_TIME 320
// For Loop Index
#define COLORSTD_DETECT_TIME 255
/* ------------------------------------
Type Definitions
------------------------------------ */
/* ------------------------------------
Variables Definitions
------------------------------------ */
/* ------------------------------------
Function Prototypes
------------------------------------ */
/* -------------------------------------------------------------------
Name: VP_BlankColor -
Purpose: To enable/disable FREE-RUN blank color feature.
Passed:
BOOL fOn Enable (TRUE) or Disable (FALSE).
Returns: None.
Notes: [1]40
------------------------------------------------------------------- */
void VP_BlankColor (BOOL fOn)
{
UB8 b40;
b40 = BITEK_RxByte(VP_MAD, VP_040_TESTPAT_ATTR);
if (fOn)
b40 |= VP_MASK_FREERUN_EN; // Free Run !
else
b40 &= (~VP_MASK_FREERUN_EN);
BITEK_TxByte(VP_MAD, VP_040_TESTPAT_ATTR, b40);
} /* VP_BlankColor */
#if (VP_DISPLAYMODE)
/* -------------------------------------------------------------------
Name: VP_DisplayMode (YUV_01_BIT1611B) -
Purpose: To set display mode.
Passed:
UB8 bDisplayMode DISPLAY_MODE_BYPASS or DISPLAY_MODE_LINEAR
Returns: None.
Notes:
------------------------------------------------------------------- */
void VP_DisplayMode (UB8 bDisplayMode)
{
// [V00041] Added by JC 05:17PM 2006/03/05
BITEK_TxByte(VP_MAD, VP_005_INT_ATTR, 0x20);
bDisplayMode = bDisplayMode;
BITEK_TxByte(VP_MAD, VP_005_INT_ATTR, 0x30);
} /* VP_DisplayMode */
#endif
/* -------------------------------------------------------------------
Name: VP_HardwareReset -
Purpose: To Reset VP hardware.
Passed:
Returns:
Notes: [1]17
------------------------------------------------------------------- */
void VP_HardwareReset (void)
{
VP_RESET_OFF;
TIMER_DelayMS(50);
VP_RESET_ON; // Reset !
TIMER_DelayMS(100); // At least 4 XCLK cycles !
VP_RESET_OFF;
TIMER_DelayMS(50);
} /* VP_HardwareReset */
/* -------------------------------------------------------------------
Name: VP_Init -
Purpose: To initiate VP module.
Passed: None.
Returns: None.
Notes:
------------------------------------------------------------------- */
void VP_Init (void)
{
switch (tsEYD.bYUV_ID)
{
case YUV_ID_CVBS_11:
case YUV_ID_CVBS_21:
case YUV_ID_YC_Y12C22:
// Defaul Values !
BITEK_TxBurst(VP_MAD, VP_007_PORT_ATTR, sizeof(abVP_007_0A7_DEFAULT), abVP_007_0A7_DEFAULT);
break;
}
#ifdef NOT_JUNK
/* ....................................
[1]73 Gamma LUT
.................................... */
{
UB8 bA2;
bA2 = BITEK_RxByte(VP_MAD, VP_0A2_GAMMA_ATTR) & ~VP_MASK_GAMMA_LUT_EN;
// To disable RGB Gamma Tables
BITEK_TxByte(VP_MAD, VP_0A2_GAMMA_ATTR, bA2);
// To set RGB Gamma Tables
BITEK_TxBurst(VP_MAD, VP_0200_02FF_GAMMA_LUT_R + 0 , sizeof(abGammaR)/2, &abGammaR[ 0 ]);
BITEK_TxBurst(VP_MAD, VP_0200_02FF_GAMMA_LUT_R + 128, sizeof(abGammaR)/2, &abGammaR[ 128 ]);
BITEK_TxBurst(VP_MAD, VP_0300_03FF_GAMMA_LUT_G + 0 , sizeof(abGammaR)/2, &abGammaG[ 0 ]);
BITEK_TxBurst(VP_MAD, VP_0300_03FF_GAMMA_LUT_G + 128, sizeof(abGammaR)/2, &abGammaG[ 128 ]);
BITEK_TxBurst(VP_MAD, VP_0400_04FF_GAMMA_LUT_B + 0 , sizeof(abGammaR)/2, &abGammaB[ 0 ]);
BITEK_TxBurst(VP_MAD, VP_0400_04FF_GAMMA_LUT_B + 128, sizeof(abGammaR)/2, &abGammaB[ 128 ]);
// To enable RGB Gamma Tables
BITEK_TxByte(VP_MAD, VP_0A2_GAMMA_ATTR, (bA2 | VP_MASK_GAMMA_LUT_EN));
}
/* ....................................
[1]71 Gamma Adjust-Curve
.................................... */
#endif
/* ....................................
Video Processor
.................................... */
VP_SetBlackLevel(tsEGD.bBlackLevel,
tsEGD.bWhiteSlope,
tsEGD.bBlackSlope,
tsEGD.bWhiteStart,
tsEGD.bBlackStart
);
VP_SetBrightness(tsEGD.bBrightness);
VP_SetContrast(tsEGD.bContrast);
// To adjust VP
VP_SetImageFilter(tsEGD.bImage_Filter);
// To restore VP TCON mode !
VP_SetTCON_Mode(tsEGD.bTCON_Mode);
} /* VP_Init */
#if (VP_INT_CFG != EXT_INT_NONE)
/* -------------------------------------------------------------------
Name: VP_ISR -
Purpose: .
Passed: None
Returns: None.
Notes:
Reference: [2]19
------------------------------------------------------------------- */
void VP_ISR (void) interrupt VP_INT using VP_USING
{
fVP_IntReady = TRUE;
} /* VP_ISR */
#endif
#if (VP_SET_BLACKLEVEL)
/* -------------------------------------------------------------------
Name: VP_SetBlackLevel -
Purpose: This function sets the VP BlackLevel.
Passed:
UB8 bBlackLevel
Returns: None.
Notes: [1]65
------------------------------------------------------------------- */
void VP_SetBlackLevel (
UB8 bBlackLevel,
UB8 bWhiteSlope,
UB8 bBlackSlope,
UB8 bWhiteStart,
UB8 bBlackStart
)
{
BITEK_TxByte(VP_MAD, VP_082_BLACK_LEVEL, bBlackLevel ^ 0x80);
BITEK_TxByte(VP_MAD, VP_083_WHITE_SLOPE, bWhiteSlope);
BITEK_TxByte(VP_MAD, VP_084_BLACK_SLOPE, bBlackSlope);
BITEK_TxByte(VP_MAD, VP_085_WHITE_START, bWhiteStart);
BITEK_TxByte(VP_MAD, VP_086_BLACK_START, bBlackStart);
} // VP_SetBlackLevel
#endif
#if (VP_SET_COLORSTANDARD)
/* -------------------------------------------------------------------
Name: VP_SetColorStandard - (YUV_01_BIT1611B)
Purpose: To adjust Video Processor register settings according to
Color Standard mode.
Passed:
UB8 bMode YUV_CS_NTSC or
YUV_CS_PAL_BGDHI or
YUV_CS_SECAM_L
Returns:
Notes:
------------------------------------------------------------------- */
void VP_SetColorStandard (UB8 bMode)
{
//UB8 b615;
return;
/////////////////////////////////////////////
switch (tsEYD.bYUV_ID)
{
case YUV_ID_CVBS_11:
case YUV_ID_CVBS_21:
case YUV_ID_YC_Y12C22:
case YUV_ID_YC_Y11C21:
switch (bMode)
{
// 50Hz
case YUV_CS_PAL:
case YUV_CS_PAL_N:
case YUV_CS_SECAM:
case YUV_CS_NTSC_443_50:
break;
// 60Hz
case YUV_CS_NTSC:
case YUV_CS_PAL_M:
case YUV_CS_NTSC_M:
case YUV_CS_NTSC_443_60:
case YUV_CS_PAL_60:
default:
break;
} // switch bMode
//BITEK_TxByte(YUV_MAD, VP_615_CHROMA_ATTR4, b615);
/* ....................................
Video Decoder
.................................... */
YUV_SetBrightness(tsEYD.bBrightness);
YUV_SetContrast(tsEYD.bContrast);
YUV_SetSaturation(tsEYD.bSaturation);
YUV_SetHue(tsEYD.bHue);
break;
} /* tsEYD.bYUV_ID */
/* ....................................
Video Decoder
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -