📄 drvgop.c
字号:
GOP_GWIN_UpdateReg();
}
#endif
/********************************************************************************/
/// Set GWIN output color domain
/// @param type \b IN YUV or RGB
/********************************************************************************/
void MDrv_GOP_GWIN_OutputColor(GOPOUTPUTCOLOR type)
{
U16 regval;
GOP_Read16Reg(GOP_PDATA_WR, ®val);
if(type == GOPOUT_YUV)
regval |= 0x80;
else
regval &= ~0x80;
GOP_Write16Reg(GOP_PDATA_WR, regval, GOP_REG_WORD_MASK);
GOP_GWIN_UpdateReg();
}
/********************************************************************************/
/// Set GWIN post destination
/// @param type \b IN OP2 or VOP
/********************************************************************************/
/*void MDrv_GOP_GWIN_OutputDest(GOPOUTPUTDEST type)
{
#if 0
U8 regval;
regval = GOP_Get_Reg(GOP_GWIN_MD_DUP);
if(type == GOPOUT_YUV)
regval |= 0x80;
else
regval &= ~0x80;
GOP_Set_Reg(GOP_GWIN_MD_DUP, regval);
GOP_GWIN_UpdateReg();
#endif
} //*/
#endif
/********************************************************************************/
/// Set the time when new GWIN settings take effect
/// @param bEnable \b IN
/// - # TRUE the new setting moved from internal register buffer
/// to active registers immediately
/// - # FALSE new settings take effect when next VSYNC is coming
/********************************************************************************/
void MDrv_GOP_GWIN_SetForceWrite(BOOLEAN bEnable)
{
gop_gwin_frwr = bEnable;
}
/********************************************************************************/
/// Set GWIN display mode
/// @param bEnable \b IN
/// - # TRUE Interlaced (read out the DRAM graphic data by FIELD)
/// - # FALSE Progressive (not care FIELD)
/// @internal please verify the register document and the code
/********************************************************************************/
void MDrv_GOP_GWIN_EnableProgressive(BOOLEAN bEnable)
{
U16 regval;
GOP_Read16Reg(GOP_GWIN_EN, ®val);
if(bEnable)
{
regval |= 0x100;
}
else
{
regval &= ~0x100;
}
// GOP_Set_Reg(GOP_GWIN_MD_DUP, regval);
GOP_Write16Reg(GOP_GWIN_EN, regval, GOP_REG_WORD_MASK);
GOP_GWIN_UpdateReg();
}
/********************************************************************************/
/// Set transparent color for the GWIN in ARGB8888 format
/// @param clr \b IN transparent color
/// @param mask \b IN mask for trs color
/********************************************************************************/
void MDrv_GOP_GWIN_SetTransClr_8888(U32 clr, U32 mask)
{
U16 regval;
regval = (U16)(clr&0xffff);
GOP_Write16Reg(GOP_TRS_CLR_L, regval, GOP_REG_WORD_MASK);
regval = (U16)((clr>>16&0xff))|(U16)((mask&0xff)<<8) ;
GOP_Write16Reg(GOP_TRS_CLR_H, regval, GOP_REG_WORD_MASK);
regval = (U16)((mask >> 8) & 0xffff) ;
GOP_Write16Reg(GOP_TRS_MASK, regval, GOP_REG_WORD_MASK);
GOP_GWIN_UpdateReg();
}
/********************************************************************************/
/// Set transparent color for the GWIN
/// @param fmt \b IN SATURN transparent format (For backward compatibility)
/// @param clr \b IN Transparent color for in specific color format.
/********************************************************************************/
void MDrv_GOP_GWIN_SetTransClr(GOPTRANSCLRFMT fmt, U16 clr)
{
U32 fullclr = 0;
if(fmt == GOPTRANSCLR_FMT0) {
/***** !RGB555 *****/
fullclr = ((clr>>10)&0x1f)<<3; // R
fullclr |= ((clr>>12)&0x7);
fullclr = fullclr << 8;
fullclr |= ((clr>>5)&0x1f)<<3; // G
fullclr |= ((clr>>7)&0x7);
fullclr = fullclr << 8;
fullclr |= (clr&0x1f)<<3; // B
fullclr |= ((clr>>2)&0x7); // B
}
else if(fmt == GOPTRANSCLR_FMT1) {
/***** index mode *****/
MDrv_GOP_GWIN_ReadPalette(clr, &fullclr);
}
MDrv_GOP_GWIN_SetTransClr_8888(fullclr, 0);
}
/********************************************************************************/
/// Enable or Disable transparent color
/// @param fmt \b IN @copydoc GOPTRANSCLRFMT
/// @param bEnable \b IN
/// - # TRUE enable transparent color
/// - # FALSE disable transparent color
/********************************************************************************/
void MDrv_GOP_GWIN_EnableTransClr(GOPTRANSCLRFMT fmt, BOOLEAN bEnable)
{
U16 regval;
// Dummy code for avoid compile warning
regval = (U16) fmt;
GOP_Read16Reg(GOP_GWIN_EN, ®val);
if(bEnable)
regval |= 0x8000;
else
regval &= ~0x8000;
GOP_Write16Reg(GOP_GWIN_EN, regval, GOP_REG_WORD_MASK);
GOP_GWIN_UpdateReg();
}
/********************************************************************************/
/// Get Alpha value of 4 Gwins
/// @param u16GWin01Alpha \b IN Alpha coefficient and Enable status of Gwin 0/1
/// @param u16GWin23Alpha \b IN Alpha coefficient and Enable status of Gwin 2/3
/********************************************************************************/
void MDrv_GOP_GWIN_GetAlpha(U16 * u16GWin01Alpha, U16 * u16GWin23Alpha)
{
GOP_Read16Reg(GOP_GWIN_ALPHA01, u16GWin01Alpha);
GOP_Read16Reg(GOP_GWIN_ALPHA23, u16GWin23Alpha);
}
/********************************************************************************/
/// Set Alpha value of 4 Gwins
/// @param u16GWin01Alpha \b IN Alpha coefficient and Enable status of Gwin 0/1
/// @param u16GWin23Alpha \b IN Alpha coefficient and Enable status of Gwin 2/3
/********************************************************************************/
void MDrv_GOP_GWIN_SetAlpha(U16 * u16GWin01Alpha, U16 * u16GWin23Alpha)
{
GOP_Write16Reg(GOP_GWIN_ALPHA01, *u16GWin01Alpha, GOP_REG_WORD_MASK);
GOP_Write16Reg(GOP_GWIN_ALPHA23, *u16GWin23Alpha, GOP_REG_WORD_MASK);
}
#if 1
/********************************************************************************/
/// Set GWIN Blink
/// @param bEnable \b IN
/// - # TRUE enable
/// - # FALSE disable
/// @param u8rate \b IN Blink frame rate
/********************************************************************************/
void MDrv_GOP_GWIN_SetBlink(BOOLEAN bEnable, U8 u8rate)
{
U16 regval;
GOP_Read16Reg(GOP_BLINK, ®val);
if(bEnable)
{
GOP_Write16Reg(GOP_BLINK, regval | 0x80 | (u8rate & 0x7F), GOP_REG_WORD_MASK);
}
else
{
regval = regval &0xff00;
GOP_Write16Reg(GOP_BLINK, regval, GOP_REG_WORD_MASK);
// GOP_Set_Reg(GOP_GWIN_TRS_CLR1_H, 0x0);
}
GOP_GWIN_UpdateReg();
}
/********************************************************************************/
/// Set GWIN auto scrolling frame rate
/// @param u8rate \b IN frame rate
/********************************************************************************/
void MDrv_GOP_GWIN_SetScrollRate(U8 u8rate)
{
U16 regval;
GOP_Read16Reg(GOP_BLINK, ®val);
regval &= 0x00ff;
regval |= (u8rate << 8) ;
GOP_Write16Reg(GOP_BLINK, regval, GOP_REG_WORD_MASK);
}
/********************************************************************************/
/// Set horizontal auto scroll
/// @param u8win \b IN GWIN id 0 ~ (MAX_GWIN_SUPPORT-1)
/// @param type \b IN @copydoc GOPSCROLLTYPE
/// @param bEnable \b IN
/// - # TRUE enable
/// - # FALSE disable
/********************************************************************************/
void MDrv_GOP_GWIN_SetHScroll(U8 u8win, GOPSCROLLTYPE type, BOOLEAN bEnable)
{
U16 regval;
//----------------------------------------------------------------
// Set scroll type
//----------------------------------------------------------------
GOP_Read16Reg(GOP_ROLL, ®val);
if(type == GOP_SCROLL_LEFT)
regval |= ((U16)((U16)0x10<<u8win)<<8);
else if(type == GOP_SCROLL_RIGHT)
regval &= ((U16)(~((U16)0x10<<u8win))<<8);
//----------------------------------------------------------------
// Enable
//----------------------------------------------------------------
if(bEnable)
regval |= ((U16)((U16)1<<u8win)<<8);
else
regval &= ((U16)(~((U16)1<<u8win))<<8);
GOP_Write16Reg(GOP_ROLL, regval, GOP_REG_WORD_MASK);
GOP_GWIN_UpdateReg();
}
/********************************************************************************/
/// Set GWIN vertical auto scrolling
/// @param u8win \b IN GWIN id 0 ~ (MAX_GWIN_SUPPORT - 1)
/// @param type \b IN \copydoc GOPSCROLLTYPE
/// @param bEnable \b IN
/// - # TRUE enable
/// - # FALSE disable
/********************************************************************************/
void MDrv_GOP_GWIN_SetVScroll(U8 u8win, GOPSCROLLTYPE type, BOOLEAN bEnable)
{
U16 regval;
GOP_Read16Reg(GOP_ROLL,®val );
if(type == GOP_SCROLL_UP)
regval |= ((U16)0x10<<u8win);
else if(type == GOP_SCROLL_DOWN)
regval &= ~((U16)0x10<<u8win);
if(bEnable)
regval |= ((U16)1<<u8win);
else
regval &= ~((U16)1<<u8win);
GOP_Write16Reg(GOP_ROLL, regval, GOP_REG_WORD_MASK);
GOP_GWIN_UpdateReg();
}
#endif
/********************************************************************************/
/// Write system default palette values to GOP registers
/********************************************************************************/
void MDrv_GOP_GWIN_SetPalette()
{
U16 i;
U16 regval;
//----------------------------------------------------------------------
// Write palette
//----------------------------------------------------------------------
for(i=0;i < 255;i++)
{
GOP_Write16Reg(GOP_PDATA, (PaletteEntry[i%PALETTE_ENTRY_NUM].u8B | (PaletteEntry[i%PALETTE_ENTRY_NUM].u8G<<8) ), GOP_REG_WORD_MASK);
regval = (PaletteEntry[i%PALETTE_ENTRY_NUM].u8R | (i<<8));
GOP_Write16Reg(GOP_PDATA_ADR, regval, GOP_REG_WORD_MASK);
GOP_Write16Reg(GOP_PDATA_WR, 0x0001, 0x0003); // Enable pallete write
GOP_Write16Reg(GOP_PDATA_WR, 0x0000, 0x0003); // Clear pallete write
}
}
/********************************************************************************/
/// Write optional palette values to GOP registers
/// @param *pPalArray \b IN Pointer to pallete list gonna set into pallete table
/// @param u32PalStart \b IN start of pallete table gonna be overwrite
/// @param u32PalEnd \b IN end of pallete table gonna be overwrite
/// @param ePalType \b IN Pallete format, true/false(ARGB6666/RGB888)
/********************************************************************************/
void MDrv_GOP_GWIN_SetPaletteOpt( GopPaletteEntry *pPalArray, U16 u32PalStart, U16 u32PalEnd, GopPalType ePalType)
{
U16 i;
U16 regval;
//----------------------------------------------------------------------
// Write palette
//----------------------------------------------------------------------
for(i=u32PalStart; i<=u32PalEnd ; i++)
{
regval = i;
regval = regval << 8;
regval += pPalArray->RGB.u8R;
GOP_Write16Reg(GOP_PDATA_ADR, regval, GOP_REG_WORD_MASK);
GOP_Write16Reg(GOP_PDATA, ((U16)pPalArray->RGB.u8B | (U16)(pPalArray->RGB.u8G<<8) ), GOP_REG_WORD_MASK);
GOP_Write16Reg(GOP_PDATA_ADR, regval, GOP_REG_WORD_MASK);
if (ePalType)
GOP_Write16Reg(GOP_PDATA_WR, 0x0005, 0x0007); // Enable pallete write
else
GOP_Write16Reg(GOP_PDATA_WR, 0x0001, 0x0007); // Enable pallete write
GOP_Write16Reg(GOP_PDATA_WR, 0x0000, 0x0003); // Clear pallete write
pPalArray++;
}
}
/********************************************************************************/
/// Set GWIN alpha blending
/// @param u8win \b IN \copydoc GWINID
/// @param bEnable \b IN
/// - # TRUE enable alpha blending
/// - # FALSE disable alpha blending
/// @param u8coef \b IN alpha blending coefficient (0-7)
/********************************************************************************/
void MDrv_GOP_GWIN_SetBlending(U8 u8win, BOOLEAN bEnable, U8 u8coef)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -