⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sys_func.c

📁 开发环境ADSP6++,EBF_561开发板所有源代码
💻 C
字号:
#include "system.h"

short VideoOutDes[8] = 
{
	0,0,0,0x6815,864,2,625,2
};
#define Y_y_modify 292// 289 + 1 +2
#define Y_uv_modify 2024//292 + 1728

//DMA + 4:2:0 -->  4:2:2
short Descri_VideoOut_S0_M[] = 
{/*SAL,SAH,DMACFG,XCNT,XMOD,YCNT,YMOD*/
 0,0,0x4711,360,1,288,121,//y_filed_1
 0,0,0x4711,360,1,288,121,//y_filed_1'
//0,0,0,0,0,0,0,
 0,0,0x4711,180,1,144,61,//u_filed_1
 0,0,0x4711,180,1,144,61,//u_filed_1'	
 0,0,0x4711,180,1,144,61,//u'_filed_1
 0,0,0x4711,180,1,144,61,//u'_filed_1'
 0,0,0x4711,180,1,144,61,//v_filed_1
 0,0,0x4711,180,1,144,61,//v_filed_1'
 0,0,0x4711,180,1,144,61,//v'_filed_1
 0,0,0x4711,180,1,144,61,//v'_filed_'   
//0,0,0,0,0,0,0,
// 0,0,0x4719,360,4,288,289,
0,0,0x0011,1440,1,288,289,//v'_filed_'   
0,0,0,0,0,0,0 
};


short Descri_VideoOut_D0_M[] = 
{/*SAL,SAH,DMACFG,XCNT,XMOD,YCNT,YMOD*/
 0,0,0x4713,360,4,288,Y_y_modify,//y_filed_1
 0,0,0x4713,360,4,288,Y_y_modify,//y_filed_1'
//0,0,0,0,0,0,0,
 0,0,0x4713,180,8,144,Y_uv_modify,//u_filed_1
 0,0,0x4713,180,8,144,Y_uv_modify,//u_filed_1'	
 0,0,0x4713,180,8,144,Y_uv_modify,//u'_filed_1
 0,0,0x4713,180,8,144,Y_uv_modify,//u'_filed_1'
 0,0,0x4713,180,8,144,Y_uv_modify,//v_filed_1
 0,0,0x4713,180,8,144,Y_uv_modify,//v_filed_1'
 0,0,0x4713,180,8,144,Y_uv_modify,//v'_filed_1
 0,0,0x4713,180,8,144,Y_uv_modify,//v'_filed_1'   Stop mode
0,0,0x0093,1440,1,288,289,//v'_filed_'   
//0,0,0,0,0,0,0,
// 0,0,0x479B,360,4,288,289,
 0,0,0,0,0,0,0 
 } ;

void Init_MDMA(unsigned char * SourceY,
			   unsigned char * SourceU,
			   unsigned char * SourceV,
			   unsigned char * Des)
{	
	unsigned char * Des_temp;
	
	Descri_VideoOut_S0_M[0] = (short)((unsigned long)SourceY);
	Descri_VideoOut_S0_M[1] = (short)((int)SourceY>>16);
	Descri_VideoOut_S0_M[7] = (short)((unsigned long)SourceY);
	Descri_VideoOut_S0_M[8] = (short)((int)SourceY>>16);
	
	//U
	Descri_VideoOut_S0_M[14] = (short)((unsigned long)SourceU);
	Descri_VideoOut_S0_M[15] = (short)((int)SourceU>>16);
	Descri_VideoOut_S0_M[21] = (short)((unsigned long)SourceU);
	Descri_VideoOut_S0_M[22] = (short)((int)SourceU>>16);
	Descri_VideoOut_S0_M[28] = (short)((unsigned long)SourceU);
	Descri_VideoOut_S0_M[29] = (short)((int)SourceU>>16);
	Descri_VideoOut_S0_M[35] = (short)((unsigned long)SourceU);
	Descri_VideoOut_S0_M[36] = (short)((int)SourceU>>16);
	//V
	Descri_VideoOut_S0_M[42] = (short)((unsigned long)SourceV);
	Descri_VideoOut_S0_M[43] = (short)((int)SourceV>>16);
	Descri_VideoOut_S0_M[49] = (short)((unsigned long)SourceV);
	Descri_VideoOut_S0_M[50] = (short)((int)SourceV>>16);
	Descri_VideoOut_S0_M[56] = (short)((unsigned long)SourceV);
	Descri_VideoOut_S0_M[57] = (short)((int)SourceV>>16);
	Descri_VideoOut_S0_M[63] = (short)((unsigned long)SourceV);
	Descri_VideoOut_S0_M[64] = (short)((int)SourceV>>16);

	Des_temp = Des + 38304;// U_Field_2
	Descri_VideoOut_S0_M[70] = (short)((unsigned long)Des_temp);
	Descri_VideoOut_S0_M[71] = (short)((int)Des_temp>>16);
	
	
	Des_temp = Des + 38305;//Y_Field_1
	Descri_VideoOut_D0_M[0] = (short)((unsigned long)Des_temp);
	Descri_VideoOut_D0_M[1] = (short)((int)Des_temp>>16);
	Descri_VideoOut_D0_M[7] = (short)((unsigned long)Des_temp+2);
	Descri_VideoOut_D0_M[8] = (short)((int)Des_temp>>16);
	
//	Des_temp = Des + 579169;//Y_Field_2
//	Descri_VideoOut_D0_M[14] = (short)Des_temp;
//	Descri_VideoOut_D0_M[15] = (short)((int)Des_temp>>16);
//	Descri_VideoOut_D0_M[21] = (short)Des_temp+2;
//	Descri_VideoOut_D0_M[22] = (short)((int)Des_temp>>16);
	
	//U
	Des_temp = Des + 38304;//U_Field_1
	Descri_VideoOut_D0_M[14] = (short)((unsigned long)Des_temp);
	Descri_VideoOut_D0_M[15] = (short)((int)Des_temp>>16);
	
	//Des_temp = Des + 579168;//U_Field_2 
	Descri_VideoOut_D0_M[21] = (short)((unsigned long)Des_temp+4);
	Descri_VideoOut_D0_M[22] = (short)((int)Des_temp>>16);	
	
	Des_temp = Des + 40032;//U'_Field_1 38304+1728
	Descri_VideoOut_D0_M[28] = (short)((unsigned long)Des_temp);
	Descri_VideoOut_D0_M[29] = (short)((int)Des_temp>>16);
	
//	Des_temp = Des + 580896;//U'_Field_2 579168 + 1728
	Descri_VideoOut_D0_M[35] = (short)((unsigned long)Des_temp+4);
	Descri_VideoOut_D0_M[36] = (short)((int)Des_temp>>16);
	
	//V
	Des_temp = Des + 38306;//V_Field_1
	Descri_VideoOut_D0_M[42] = (short)((unsigned long)Des_temp);
	Descri_VideoOut_D0_M[43] = (short)((int)Des_temp>>16);
//	Des_temp = Des + 579170;//V_Field_2
	Descri_VideoOut_D0_M[49] = (short)((unsigned long)Des_temp+4);
	Descri_VideoOut_D0_M[50] = (short)((int)Des_temp>>16);
	Des_temp = Des + 40034;//V'_Field_1 38306+1728
	Descri_VideoOut_D0_M[56] = (short)((unsigned long)Des_temp);
	Descri_VideoOut_D0_M[57] = (short)((int)Des_temp>>16);
//	Des_temp = Des + 580898;//V'_Field_2 579170 + 1728
	Descri_VideoOut_D0_M[63] = (short)((unsigned long)Des_temp+4);
	Descri_VideoOut_D0_M[64] = (short)((int)Des_temp>>16);
	Des_temp = Des + 579168;// U_Field_2
	Descri_VideoOut_D0_M[70] = (short)((unsigned long)Des_temp);
	Descri_VideoOut_D0_M[71] = (short)((int)Des_temp>>16);
	
}

/*******************************************************************/

#define NUM_OF_VOUT_FRAMES 1

#define PAL

#ifdef PAL
#define VIDEO_X_COUNT (4+280+4+1440)
#define VIDEO_Y_COUNT (625)
#else
#define VIDEO_X_COUNT (4+268+4+1440)
#define VIDEO_Y_COUNT (525)
#endif

//------------------------------------------------------------------------------
// Function Declarations
//------------------------------------------------------------------------------
unsigned int OutputLine(volatile unsigned int *p, unsigned int line);
volatile unsigned int *pSOURCE;
//------------------------------------------------------------------------------
// Procedure:	Init_VideoOutFrameBuff
// Inputs:		none
// Outputs:		none
// Description:	
//------------------------------------------------------------------------------
void Init_VideoOutFrameBuff(unsigned char * SDRAM_START_ADDR1)
{
	unsigned int l1, l2;
	volatile unsigned int *p;

	p = (volatile unsigned int *)SDRAM_START_ADDR1;
	
	for (l1 = 0; l1 < NUM_OF_VOUT_FRAMES; l1++)
	{
		for (l2 = 0; l2 < VIDEO_Y_COUNT; l2++)
		{
			p = (volatile unsigned int *)OutputLine(p, l2 + 1);
		}
	}

	
}

//------------------------------------------------------------------------------
// Procedure:	OutputLine
// Inputs:		*p, line
// Outputs:		none
// Description:	
//------------------------------------------------------------------------------
unsigned int OutputLine(volatile unsigned int *p, unsigned int line)
{
	int i;
	static bool V = 1, F = 1;
	unsigned int code;

#ifdef PAL
	// V-digital field blanking (PAL).
	if (line == 624) V = 1;	// Start  / Field 1
	if (line == 23)  V = 0;	// Finish / Field 1
	if (line == 311) V = 1;	// Start  / Field 2
	if (line == 336) V = 0;	// Finish / Field 2

	// F-digital field identification (PAL).
	if (line == 1)
		F = 0;	// Field 1
	if (line == 313)
		F = 1;	// Field 2
#else
	// V-digital field blanking (PAL).
	if (line == 1)   V = 1;	// Start  / Field 1
	if (line == 20)  V = 0;	// Finish / Field 1
	if (line == 264) V = 1;	// Start  / Field 2
	if (line == 283) V = 0;	// Finish / Field 2

	// F-digital field identification (PAL).
	if (line == 4)
		F = 0;	// Field 1
	if (line == 266)
		F = 1;	// Field 2
#endif

	// End Active Video (EAV)
	if (V & F)
		*p++ = 0xF10000FF;
	if (!V & F)
		*p++ = 0xDA0000FF;
	if (V & !F)
		*p++ = 0xB60000FF;
	if (!V & !F)
		*p++ = 0x9D0000FF;

#ifdef PAL	
	// HANK ??
	for	(i = 0; i < (280/4); i++)
		*p++ = 0x10801080;
#else
	// HANK ??
	for	(i = 0; i < (268/4); i++)
		*p++ = 0x10801080;
#endif

	// Start Active Video (SAV)
	if (V & F)
		*p++ = 0xEC0000FF;
	if (!V & F)
		*p++ = 0xC70000FF;
	if (V & !F)
		*p++ = 0xAB0000FF;
	if (!V & !F)
		*p++ = 0x800000FF;

	// Active Video

		for	(i = 0; i < (1440/4); i++)
			*p++ = 0x10801080;

	return (unsigned int)p;
}

/*******************************************************************/
void GlobVarInit()
{
	MemDmaRun = IDLE;
	DisplayBufferSel = VIDEOBUFFER1;	

	AllowToDecoder = TRUE;


	MemDmaNum= 0;
	StartMemDmaNum=0;
	DisplayRefrashNum = 0;
}

void Delay(DWORD value)
{
	DWORD i;
	for(i = 0; i < value; i++)
	{
		asm("nop;")	;
	}
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -