📄 osdm.c
字号:
}
/************************************************************************/
/************************************************************************/
void OsdPositionSet( void )
{
#if (INTERNALOSD) //algu 1204
#if ( PANEL_DEFAULT != PANEL_CHIMEI )
Byte a;
#endif
SlvAdr = OSD_ADDRESS;
ByteCnt = 3;
TrmBuf[0] = 0xCC;
#if ( PANEL_DEFAULT == PANEL_CHIMEI )
TrmBuf[1] = OSDHorPosition*2;
TrmBuf[2] = OSDVerPosition*2+1;
#else
TrmBuf[1] = OSDHorPosition;
TrmBuf[2] = 2*OSDVerPosition+1;
#endif
SendData();
SlvAdr = ZURAC_ADDRESS;
ByteCnt = 3;
TrmBuf[0] = 0xCC;
#if ( PANEL_DEFAULT == PANEL_CHIMEI )
TrmBuf[1] = OSDHorPosition;
#else
a = OSDHorPosition - OSD_HPOS_MIN;
a = a*3/4;
TrmBuf[1] = a+9;
#endif
TrmBuf[2] = OSDVerPosition;
SendData();
#else
SlvAdr = OSD_ADDRESS;
ByteCnt = 3;
TrmBuf[0] = 0xCC;
// TrmBuf[1] = OSDHorPosition; //algu 1113 //+72; Bill
TrmBuf[1] = a+9;
TrmBuf[2] = OSDVerPosition;
SendData();
#endif
}
/************************************************************************/
/************************************************************************/
void OsdOpenUp( void )
{
#if (INTERNALOSD) //algu 1204
#if ( PANEL_DEFAULT != PANEL_CHIMEI )
Byte a;
#endif
SlvAdr = OSD_ADDRESS;
ByteCnt = 5;
TrmBuf[0] = 0xCC;
#if ( PANEL_DEFAULT == PANEL_CHIMEI )
TrmBuf[1] = OSDHorPosition*2;
TrmBuf[2] = OSDVerPosition*2+1;
#else
TrmBuf[1] = OSDHorPosition;
TrmBuf[2] = 2*OSDVerPosition+1;
#endif
TrmBuf[3] = 0xCC;
TrmBuf[4] = 0x1D;
SendData();
ShortDelay(50); //internal OSD and external OSD show at same time
SlvAdr = ZURAC_ADDRESS;
ByteCnt = 5;
TrmBuf[0] = 0xCC;
#if ( PANEL_DEFAULT == PANEL_CHIMEI )
TrmBuf[1] = OSDHorPosition;
#else
a = OSDHorPosition - OSD_HPOS_MIN;
a = a*3/4;
TrmBuf[1] = a+9;
#endif
TrmBuf[2] = OSDVerPosition;
TrmBuf[3] = 0xCC;
TrmBuf[4] = 0x1D;
SendData();
#else
SlvAdr = OSD_ADDRESS;
ByteCnt = 5;
TrmBuf[0] = 0xCC;
TrmBuf[1] = OSDHorPosition; //algu 1113 //+72; //Bill
TrmBuf[2] = OSDVerPosition;
TrmBuf[3] = 0xEC;
TrmBuf[4] = 0x1D;
SendData();
#endif
}
/************************************************************************
* Function : OsdInitCtrl *
* Description : OSD Control Register initialization *
* Input : none *
* Ouutput : none *
************************************************************************/
void OsdInitCtrl( void )
{
DataPointer = OSDM_INITIAL;
OsdWriteControl(0xC1,DataPointer,15);
#if (INTERNALOSD) //algu 1204
ZuracWriteControl(0xCA,DataPointer+9,6);
#endif
DataPointer = OSDM_INITIAL2;
OsdWriteControl(0xD0,DataPointer,19);
}
/***************************************************************************/
/* void OsdWrite(Byte addr, Byte content) */
/* Function : Write 'content' to OSD address 'addr' */
/***************************************************************************/
void OsdWrite(Byte addr, Byte content)
{
SlvAdr = OSD_ADDRESS;
ByteCnt = 2;
TrmBuf[0] = addr;
TrmBuf[1] = content;
SendData();
}
/***************************************************************************/
/* void OsdWriteChar(Byte content, Byte attr) */
/* Function : Write 'content' and 'attr' to current OSD address */
/***************************************************************************/
void OsdWriteChar(Byte content, Byte attr)
{
SlvAdr = OSD_ADDRESS;
ByteCnt = 2;
TrmBuf[0] = OSDAT;
TrmBuf[1] = attr;
SendData();
ByteCnt = 2;
TrmBuf[0] = OSDDT;
TrmBuf[1] = content;
SendData();
}
/***************************************************************************/
/* void OsdDisableWindow(Byte index) */
/* Function : disable a OSD window */
/***************************************************************************/
void OsdDisableWindow(Byte index)
{
SlvAdr = OSD_ADDRESS;
ByteCnt = 4;
TrmBuf[0] = OSDM_WINDOW_ADDR[index-1]; /* starting address */
TrmBuf[1] = 0x00;
TrmBuf[2] = 0x09;
TrmBuf[3] = 0x00;
SendData();
}
/***************************************************************************/
/* void OsdSelectPage(Byte index) */
/* Function : set font set( 1st font set or 2nd font set ) */
/***************************************************************************/
void OsdSelectPage(Byte index)
{
SlvAdr = OSD_ADDRESS;
ByteCnt = 2;
TrmBuf[0] = 0xCB; /* OSD-start row, bit 4 : D8 */
if( index==0 ) TrmBuf[1] = 0x20; /* OSD-start row,D8 bit 4 is 0 */
else TrmBuf[1] = 0x30; /* OSD-start row,D8 bit 4 is 1 */
SendData();
}
/***************************************************************************/
/* void OsdSetAddress(Byte row, Byte col) */
/* Function : transform (row,col) to T8570 register address setting */
/***************************************************************************/
void OsdSetAddress(Byte row, Byte col)
{
SlvAdr = OSD_ADDRESS;
ByteCnt = 2;
if( row < 8 )
{
TrmBuf[0] = 0x5B;
TrmBuf[1] = (row<<5) + col+1; /* !!! transform to t8570 column */
}
else
{
TrmBuf[0] = 0x5C;
TrmBuf[1] = ((row-8)<<5) + col+1; /* !!! transform to t8570 column */
}
SendData();
}
/***************************************************************************/
/* void OsdSetRowAttr() */
/* Function : set OSD row attribute */
/***************************************************************************/
void OsdSetRowAttr(Byte row, Byte attr_hi, Byte attr_lo)
{
SlvAdr = OSD_ADDRESS;
ByteCnt = 2;
if( row < 8 )
{
TrmBuf[0] = 0x5B;
TrmBuf[1] = (row<<5);
}
else
{
TrmBuf[0] = 0x5C;
TrmBuf[1] = ((row-8)<<5);
}
SendData();
/* write attribute */
/* OsdWriteChar(attr_hi, attr_lo); */
ByteCnt = 2;
TrmBuf[0] = OSDAT;
TrmBuf[1] = attr_lo;
SendData();
ByteCnt = 2;
TrmBuf[0] = OSDDT;
TrmBuf[1] = attr_hi;
SendData();
}
/***************************************************************************/
/* void OsdWriteControl() */
/* Function : output a control string */
/***************************************************************************/
void OsdWriteControl(Byte addr,Byte RDATA *bptr,Byte count)
{
Byte i;
SlvAdr = OSD_ADDRESS;
ByteCnt = 2;
for(i=0; i<count; i++)
{
TrmBuf[0] = addr+i;
TrmBuf[1] = *(bptr+i);
SendData();
}
}
/***************************************************************************
* Function : PrintChar
* Purpose : Print a character (ch) in position (row,col) on OSD
***************************************************************************/
void PrintChar(Byte row,Byte col,Byte ch,Byte color)
{
OsdSetAddress(row,col); /* set starting address */
OsdWriteChar(ch,color); /* write character and attribute */
}
/***************************************************************************
* Function : OsdWindow
***************************************************************************/
void OsdWindow(Byte num,Byte RDATA *owPtr)
{
/* set window */
#if T8570
SlvAdr = OSD_ADDRESS;
ByteCnt = 4;
TrmBuf[0] = OSDM_WINDOW_ADDR[num-1]; /* window starting adress */
TrmBuf[1] = *(owPtr);
TrmBuf[2] = *(owPtr+1);
TrmBuf[3] = *(owPtr+2);
// if( FgTransparency ) TrmBuf[2] |= 0x02;
SendData();
#else /* T8566 */
Byte addr;
addr = OSDM_WINDOW_ADDR[num-1]; /* window starting adress */
if( num==1 )
{
OsdWrite(addr+1,0x00);
}
OsdWrite(addr ,*owPtr); /* Vertical range of window */
OsdWrite(addr+2,*(owPtr+2)); /* Horizontal Ending */
OsdWrite(addr+1,*(owPtr+1)); /* Horizontal Start */
#endif
/* set shadow */
ByteCnt = 2;
TrmBuf[0] = OSDM_SHADOW_ADDR[num-1]; /* shadow starting address */
// if( num==6 ) TrmBuf[1] = 0x11; /* Enable, Black width(H2,V2) */
// else TrmBuf[1] = 0x01; /* Disable, Black width(H2,V2) */
TrmBuf[1] = 0x01;
SendData();
}
/***************************************************************************/
/* void OsdSetString(Byte RDATA *strptr,Byte items,Byte sel,Bool fgLang) */
/* Function : set starting address to DataPointer */
/***************************************************************************/
void OsdSetString(Byte RDATA *strptr,Byte items,Byte sel,Bool fgLang)
{
Byte DATA i,j;
if( fgLang ) /* multi-language string */
{
for(i=0; i<OSDLanguage; i++) /* skip to Language start */
{
for(j=0; j<items; j++)
{
while( *strptr != _EOF )
{
strptr++;
}
strptr++;
}
}
}
for(j=0; j<sel; j++)
{
while( *strptr != _EOF )
{
strptr++;
}
strptr++;
}
DataPointer = strptr;
}
// /***************************************************************************
// * Function : ShowCursor(Byte Wnum,Byte RDATA *owPtr);
// * Purpose : Show cursor window
// ***************************************************************************/
// void ShowCursor(Byte Wnum,Byte RDATA *owPtr,Byte Item)
// {
// OsdWindow(Wnum,(owPtr+Item));
// }
/***************************************************************************
* Function : PrintString
* Purpose : Print a string in OSD. The strptr pointer is first character
***************************************************************************/
void PrintString(Byte row,Byte col,Byte color,Byte RDATA *strptr)
{
Byte i,j;
Bool fgPage;
if( *strptr==_EOF ) return;
for( i=j=0; *(strptr+i)!=_EOF; i++ ) /* total character count */
{
if( *(strptr+i) != _ESC ) /* a normal character code */
j++;
if( j>=30 ) break;
}
row &= 0x0F; /* mask off other attribute */
if( col==MIDDLE ) col = 13 - ((j+1)/2); /* if string will be print in the middle */
OsdSetAddress(row, col); /* set starting address */
OsdWrite(OSDAT, color); /* set attribute */
fgPage = 0;
for( i=0; *(strptr+i)!=_EOF; i++ )
{
j = *(strptr+i);
if( j != _ESC ) /* a normal character code */
{
OsdWrite(OSDDT,j);
col++;
}
else /* ESC leading code in */
{
fgPage = !fgPage;
OsdSelectPage( (Byte)fgPage );
}
if( col>=31 ) break; /* avoid overflow */ //algu 1128 30->31
} /* of while */
OsdSelectPage( 0 );
}
/************************************************************************/
// void OsdShowValue(Byte row,Byte col,Byte color)
// {
// Byte i,j;
// Word IDATA odvwval;
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -