ppi0_init.c

来自「BF561采集PAL制图像」· C语言 代码 · 共 35 行

C
35
字号
#include "main.h"

/********************************************************************************/
/***** InitPPI0()															*****/
/***** PPI0 is configured for video in in 656 mode							*****/
/***** This routine configures both the PPI and the associated DMA channel	*****/
/***** Supports Entire Field and active video only, as well as 8 and 32 bit *****/
/***** packing according to the input parameters							*****/
/***** DMA is setup in descriptor list mode, input is pointer to 1st header	*****/
/********************************************************************************/

void InitPPI0(bool entire_field, bool pack32, tDMA_descriptor* First_Header, short pixel, short lines)
{ short transfer_length_bytes = ((pack32) ? 4 : 1);

	// configure PPI0 - not enabled yet
	*pPPI0_CONTROL = (entire_field << 2) |FLD_SEL | (pack32 << 7)| (pack32 << 8);//|(0x400);//&(0xfff3);
	*pPPI0_FRAME = lines;
	ssync();

	// configure DMA for PPI0 - not enabled yet
	*pDMA1_0_X_COUNT = pixel* sizeof(short)/transfer_length_bytes;//pixel * sizeof(short) / transfer_length_bytes;	// 2 bytes for each pixel, count divided by four if 32-bit DMA transfers are done
	*pDMA1_0_Y_COUNT = lines;
	*pDMA1_0_X_MODIFY = transfer_length_bytes;		
	*pDMA1_0_Y_MODIFY = transfer_length_bytes;		
	*pDMA1_0_NEXT_DESC_PTR = First_Header;
	//*pDMA1_0_START_ADDR=sFrame0;
	*pDMA1_0_CONFIG = 0x7000 | 0x0400 | DI_EN | DMA2D | (pack32 << 3) | WNR;
	//*pDMA1_0_CONFIG=(DI_EN | DMA2D | (pack32 << 3) | WNR|0x1000)|0x20;
	
	ssync();
	
}


⌨️ 快捷键说明

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