📄 ga_api.c
字号:
/******************************************************************************
* File name : Ga_api.c
* Start date : 2002.12.16
* By : KIM DO YEON
* Contact :
* Description: S5H5002 GA API
* $Log: Ga_api.c,v $
* Revision 1.1.1.1 2005/03/29 08:09:24 wanghu
* no message
*
******************************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include "Basic_typedefs.h" /* data type definitions */
#include "S5h_capability.h"
#include "Sys_call_abstract.h"
#include "S5h_types.h"
#include "S5h_lowapi.h"
#include "S5l_reg.h"
#include "S5h_isr.h"
#include "S5l_memmap.h"
#include "sysdefine.h"
#include "All_Event.h"
/******************************************************
* Global variables / functions
*****************************************************/
#if !_USE_V1_SHOWWINDOW
SysHisr_t gGaOpHisr;
#endif
SysSema_t gGa_sema;
// int bGaHisrInitialized = 0;
/******************************************************
* Extern variables / functions
*****************************************************/
#if _USE_BLACK_CHANGING_TV
extern volatile BOOL gGraphic_layer_enabled;
#endif
extern DiscType_t GetDiscType(void);
/******************************************************************************
* Function name : GA_Isr
* Arguments :
* IN SINT tmp
*
* OUT
* I/O
* Return : VOID
*
* By : KIM DO YEON
* Description :
* Revision :
******************************************************************************
*/
VOID GA_Isr( SINT tmp )
{
ULONG temp;
//SysActivateHisr(&gGaOpHisr );
if( SysReleaseSema(&gGa_sema ) != SYS_RETURN_SUCCESS )
{
#if GA_DEBUG_PRINT
SysPrintf("\n Ga Semaphore release fail, %d, %s",
__LINE__, __FILE__);
#endif
} //release sema甫 lsr俊辑 官肺 窍绰巴栏肺 荐沥
GA_ClrIntPend();
GA_SetIntEn();//BY QQ 051111
temp = IO_RData32((unsigned char *)&rGA_CTRL);
if( (temp& 0x1) == 0x1 )
IO_WData32((unsigned char *)&rGA_CTRL, 0, (unsigned int)temp);
/* Source Pending Clear */
Intclr_Scr( INT_GA );
/* interrupt pending Clear */
Intclr_Pnd( INT_GA );
}
/******************************************************************************
* Function name : GA_ClearReg
* Arguments : void
* Return : GA_Return_t
* By : Kim Do Yeon
* Description : Initializing All GA Registers with 0
******************************************************************************
*/
GA_Return_t GA_ClearReg(void)
{
ULONG index;
volatile ULONG *temp_register_base;
temp_register_base = (ULONG *)&rGA_CTRL;
for(index = 0; index <= 1084; index += 2)
*(temp_register_base++) = 0x0000;
return GA_RETURN_DONE;
}/* GA_ClearReg() */
/******************************************************************************
* Function name : GA_ProcessOp
* Arguments : S5H_GfxBitblt_t *bitblt
* Return : void
* By : Kim Do Yeon
* Description : Process Ga operation
******************************************************************************
*/
VOID GA_ProcessOp(S5H_GfxBitblt_t *bitblt)
{
unsigned long i;
DI();
#if (!GRAPHIC_TEST)
/* Set the source information */
// bitblt->source=0;
WRITE32( (UINT8 *)&rGA_SRC_BASE_H, bitblt->source );
/* Set the width of the source */
RESETBIT_REG((unsigned char *)&rGA_SRC_CFG_H, ((unsigned long)0x3ff)<<16);
//bitblt->swidth =0;
SETBIT_REG((unsigned char *)&rGA_SRC_CFG_H, ((unsigned long)bitblt->swidth)<<16);
/* Set the soure color format */
RESETBIT_REG((unsigned char *)&rGA_SRC_CFG_H, 0xf);
SETBIT_REG((unsigned char *)&rGA_SRC_CFG_H, (unsigned long)0x1);
/* Set the destination information */
//bitblt->destination =0;
WRITE32( (UINT8 *)&rGA_DST_BASE_H, bitblt->destination );
/* Set the width of the destination */
RESETBIT_REG((unsigned char *)&rGA_DST_CFG_H, ((unsigned long)0x3ff)<<16);
SETBIT_REG((unsigned char *)&rGA_DST_CFG_H, ((unsigned long)bitblt->dest_width)<<16);
/* Set the destination color format */
RESETBIT_REG((unsigned char *)&rGA_DST_CFG_H, 0xf);
SETBIT_REG((unsigned char *)&rGA_DST_CFG_H, (unsigned long)0x1);
/* Set the information of the moving area */
//bitblt->width =0;
//bitblt->height =0;
IO_WData32((unsigned char *)&rGA_BITBLT_CFG_H, (unsigned int)(bitblt->width), (unsigned int)(bitblt->height));
IO_WData32((unsigned char *)&rGA_SRC_LOC_H, (unsigned int)(bitblt->crop_x_pos), (unsigned int)(bitblt->crop_y_pos));
IO_WData32((unsigned char *)&rGA_DST_LOC_H, (unsigned int)(bitblt->x_pos), (unsigned int)(bitblt->y_pos));
/* Set the functions during Ga operation */
/* Disable the color filling & blending */
/* Disable the color keying */
/* (0x0|((unsigned long)0x3)<<23 |((unsigned long)0xF)<<4) */
RESETBIT_REG((unsigned char *)&rGA_BITBLT_CTRL_H, (unsigned long)(0x1800000|0x240));
/* Set the operation */
GA_SetOp(bitblt);
#endif
SETBIT_REG((unsigned char *)&rGA_CTRL, (unsigned long)0x1);// Ga run
EI();
#if 1
if(GetDiscType ( ) != MP3_DISC)
{
for(i=0;i<10000;i++)
;
}
#endif
}
/******************************************************************************
* Function name : GA_SetOp
* Arguments : S5H_GfxBitblt_t *bitblt
* Return : void
* By : Kim Do Yeon
* Description : Set the ga function
******************************************************************************
*/
void GA_SetOp(S5H_GfxBitblt_t *bitblt)
{
// INT Flags;
switch(bitblt->blt_op)
{
/* Move all except key_index_color */
//source keying
case BLT_EXCLUDE_OP:
// Flags = MK_InterruptDisable();
/* SourceKeying enabled , not eq */
SETBIT_REG((unsigned char *)&rGA_BITBLT_CTRL_H, ((unsigned long)0x1)<<4);
WRITE32((UINT8 *)&rGA_KEY_SRC_H, (UINT32)bitblt->key_index_color);
// MK_InterruptRestore(Flags);
break;
/* Replace key_index_color by set_index_color */
//destination keying
case BLT_REPLACE_OP:
// Flags = MK_InterruptDisable();
/* Fill enable, blend disable */
RESETBIT_REG((unsigned char *)&rGA_BITBLT_CTRL_H, ((unsigned long)0x3)<<22);
SETBIT_REG((unsigned char *)&rGA_BITBLT_CTRL_H, ((unsigned long)0x2)<<22);
/* Destination Keying enabled, eq */
RESETBIT_REG((unsigned char *)&rGA_BITBLT_CTRL_H, ((unsigned long)0xF)<<4);
SETBIT_REG((unsigned char *)&rGA_BITBLT_CTRL_H, ((unsigned long)0x3)<<6);
/* for color filling... */
RESETBIT_REG((unsigned char *)&rGA_SRC_CFG_H, 0xF);
SETBIT_REG((unsigned char *)&rGA_SRC_CFG_H, (unsigned long)0x1);
WRITE32((UINT8 *)&rGA_KEY_DST_H, (UINT32)bitblt->key_index_color);
WRITE32((UINT8 *)&rGA_FILL_COLOR_H, (UINT32)bitblt->set_index_color);
// MK_InterruptRestore(Flags);
break;
/* Filling a rectangle with set_index_color */
case BLT_FILL_RECT_OP:
// Flags = MK_InterruptDisable();
/* Enable color filling */
RESETBIT_REG((unsigned char *)&rGA_BITBLT_CTRL_H, ((unsigned long)0x1)<<23);
SETBIT_REG((unsigned char *)&rGA_BITBLT_CTRL_H, ((unsigned long)0x1)<<23);
RESETBIT_REG((unsigned char *)&rGA_SRC_CFG_H, 0xF);
SETBIT_REG((unsigned char *)&rGA_SRC_CFG_H, (unsigned long)0x1);
WRITE32((UINT8 *)&rGA_FILL_COLOR_H, (UINT32)bitblt->set_index_color);
// MK_InterruptRestore(Flags);
break;
default:
break;
}/* bitblt->fnt_type */
}
/******************************************************************************
* Function name : GA_Initial
* Arguments :
* IN VOID
*
* OUT
* I/O
* Return : VOID
*
* By : KIM DO YEON
* Description : GA Operation Start under the GA register settting
* Revision :
******************************************************************************
*/
VOID Init_GA( VOID )
{
SysReturn_t ret;
GA_ClearReg();
#if _USE_V1_SHOWWINDOW
ret = SysCreateSema( &gGa_sema, "GA_SEMA", 0, SYS_FIFO);
#else
ret = SysCreateSema( &gGa_sema, "GA_SEMA", 1, SYS_FIFO);
#endif
ret |= SysRegisterLisr( INT_GA, GA_Isr ); /* PSD LISR Register */
if( ret == SYS_RETURN_FAIL )
{
#if GA_DEBUG_PRINT
SysPrintf("\n GA_Init fail, %d, %s",
__LINE__, __FILE__);
#endif
}
//GA_RegisterHisr();
GA_SetIntEn();
Enable_Int( INT_GA );
}
/******************************************************************************
* Function name : GA_DeInitial
* Arguments :
* IN VOID
*
* OUT
* I/O
* Return : VOID
*
* By : KIM DO YEON
* Description : Delete OS Resources
* Revision :
******************************************************************************
*/
VOID DeInit_GA( VOID )
{
SysReturn_t ret;
ret = SysDeleteSema( &gGa_sema);
#if !_USE_V1_SHOWWINDOW
ret |= SysDeleteHisr( &gGaOpHisr );
#endif
if( ret == SYS_RETURN_FAIL )
{
#if GA_DEBUG_PRINT
SysPrintf("\n Ga Semaphore delete fail, %d, %s",
__LINE__, __FILE__);
#endif
}
Disable_Int( INT_GA );
}
/******************************************************************************
* Function name : GA_RegisterHisr
* Arguments :
* IN VOID
*
* OUT
* I/O
* Return : VOID
*
* By : Hongsik Park
* Description :
* Revision :
******************************************************************************
*/
#if !_USE_V1_SHOWWINDOW
VOID GA_RegisterHisr(VOID)
{
// if(!bGaHisrInitialized) /* KBA : Not required as only BE_Init calls this and it is safe already ! */
// {
SysCreateHisr( &gGaOpHisr, "GA_Op_done", GA_OpDone,
1, S5H_GA_BATCH_HISR_SIZE );
// bGaHisrInitialized = 1;
// }
}
#endif
/******************************************************************************
* Function name : GA_OpDone
* Arguments :
* IN
* VOID
* OUT
* I/O
* Return :
* VOID
* By : Kim Do Yeon
* Description :
* Revision :
******************************************************************************
*/
VOID GA_OpDone(VOID)
{
if( SysReleaseSema(&gGa_sema ) != SYS_RETURN_SUCCESS )
{
#if GA_DEBUG_PRINT
SysPrintf("\n Ga Semaphore release fail, %d, %s",
__LINE__, __FILE__);
#endif
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -