📄 cs4954.c
字号:
/*
********************************************************************************
*
* (c) Copyright 2002, Vineyard Technologies, Inc.
*
* Filename : cs4954.c
* Programmer(s): Steve KyeongHyeon Lee
* Created : 2003/05/07
* Modified :
*
* Description : Initialize video encoder chip
********************************************************************************
*/
#include "types.h"
#include "i2c.h"
#include "cs4954.h"
//###############################################################################
// Global Variables
//###############################################################################
#ifdef USE_4954
code u8 cs4954_id = 0x00;
code u8 cs4954_reg_ntsc[21] =
{
0x0b, //0x00 //if(xxxx x1xx) mode=progressive else interlaced //2002.11.20 1ch
0x02, //0x01 //if(xxxx x1xx) mode=even field else odd field //2002.11.20 1ch
0x40, //0x00, //0x02 // July 14 2003 by Mike
0x00, //0x03 // value 0x01 is color bar pattern
0x1d, //0x1f, //0x04 // July 14 2003 by Mike
0x62, //0x60, //0x05 // July 14 2003 by Mike
0x80, //0x06
0x00, //0x07
0x03, //0x08
0x03, //0x09 // configure GPIO port
0x00, //0x0a
0x00, //0x0b
0x00, //0x0c
0x90, //0x0d
0xf4, //0x0e
0x00, //0x0f
0x1e, //0x10
0x3e, //0x11
0xf8, //0x12
0xe0, //0x13
0x43 //0x14
};
code u8 cs4954_reg_pal[21] =
{
0x4b, //0x4b, //0x00
0x30, //0x30, //0x01
0x40, //0x00, //0x00, //0x02 // July 14 2003 by Mike
0x00, //0x00, //0x03
0x1d, //0x1f, //0x1f, //0x04 // July 14 2003 by Mike
0x62, //0x60, //0x60, //0x05 // July 14 2003 by Mike
0x80, //0x80, //0x06
0x00, //0x00, //0x07
0x03, //0x03, //0x08
0x03, //0x00, //0x09 // configure GPIO port
0x00, //0x00, //0x0a
0x00, //0x00, //0x0b
0x00, //0x00, //0x0c
0x90, //0x90, //0x0d
0xf4, //0xf4, //0x0e
0x00, //0x00, //0x0f
0x15, //0x15, //0x10
0x96, //0x96, //0x11 // May 15 2003 by Mike Subcarrier Syn. in PAL Mode {96 is correct value for G1P}
0x15, //0x15, //0x12 // May 15 2003 by Mike
0x13, //0x13, //0x13
0x54 //0x54 //0x14
};
//===============================================================================
//
//===============================================================================
void cs4954_init(u8 ntsc_pal)
{
u8 i=0;
static u8 init_flag = 0;
if(ntsc_pal)
{
for(i=0; i < sizeof(cs4954_reg_pal); i++)
if(i!=0x0A)
cs4954_write(i,cs4954_reg_pal[i]);
}
else
{
for(i=0; i < sizeof(cs4954_reg_ntsc); i++)
if(i!=0x0A)
cs4954_write(i,cs4954_reg_ntsc[i]);
}
if(init_flag==0){
cs4954_write(0x0A,0x00);
init_flag=1;
}
}
//===============================================================================
//
//===============================================================================
u8 cs4954_write(u8 idx, u8 val)
{
i2c_pkt_write(cs4954_id,idx,val);
return 0;
}
#endif //#ifdef USE_4954
//===============================================================================
//
//===============================================================================
#ifdef USE_4954_GP
u8 cs4954_read(u8 idx)
{
return i2c_pkt_read(cs4954_id,idx);
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -