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

📄 flash_setup.c

📁 BF533的程序
💻 C
字号:
/******************************************************************************/
//
// Name: 	BF532-based EZ-KIT Flash Driver
//
/******************************************************************************

Purpose:		This driver sets up the EZ-KIT flash
				
				

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

#include <I2C.h>
#include <cdefBF533.h>
#include "flashsetup.h"

bool Init_SAA7115(void);
//Setup of the async interface
void Init_EBIU(void)
{
	*pEBIU_AMBCTL0	= 0xffc2ffc2;   //0x7bb27bb2; ;	// <--|Write access time = 7 cycles, read access time = 11 cycles, no ARDY
	*pEBIU_AMBCTL1	= 0xffc2ffc3;// ;	//    |0x7bb27bb3Hold time = 2 cycles, setup time = 3 cycles, transition time = 4 cycles
	*pEBIU_AMGCTL	= 0x0006;//0x0006;		
/*	*pEBIU_AMBCTL0	= 0x7bb07bb0;	// <--|Write access time = 7 cycles, read access time = 11 cycles, no ARDY
	*pEBIU_AMBCTL1	= 0x7bb07bb0;	//    |Hold time = 2 cycles, setup time = 3 cycles, transition time = 4 cycles
	*pEBIU_AMGCTL	= 0x000F;		//	  |Enable all memory banks
*/
}//end Init_EBIU


//To use the GPIOs of the flash it must be initialized
void Init_Flash(void)
{
	*pFlashA_PortA_Out = 0x0;		// clear data registers
	*pFlashA_PortA_Dir = 0xFFFF;	// set dir=output

	*pFlashA_PortB_Out = 0x01;		// initialize LED4 to ON	
}//end Init_Flash



//The GPIOs of the flash are linked to the ADV7183 reset pin as well as to the 
//switch that drives the PPI clock. 
void Init_ADV(void)
{
	*pTIMER1_CONFIG =0x0002;//TIMR1 INPUT
    *pTIMER2_CONFIG =0x0002;//TIMR2 INPUT
	if (!I2C_Init(SAA7115_IDENT_W))
	{
		while(1);
	}

	if(!Init_SAA7115())
	{
		while(1);
	}

}//end Init_ADV
#if 1
bool Init_SAA7115(void)
{
	int i;
const unsigned char saa7115_cfg_50hz_video[] = {
0x80, 0x00,/* reset tasks */
0x88, 0xd0,/* reset scaler */
0x84, 0x00,//定义IGPV 
0x85, 0x00,//IDQ翻转
0x83, 0x32,
0x87, 0x32,
0x81, 0x00,
0x86, 0x45,
0x01, 0x08,
0x02, 0xc0,
0x03, 0x20,
0x04, 0x90,
0x05, 0x90,
0x06, 0xeb,
0x07, 0xe0,
0x08, 0xb0,
0x09, 0x50,
0x0a, 0x80,
0x0b, 0x40,
0x0c, 0x40,
0x0d, 0x00,
0x0e, 0x03,
0x0f, 0x24,
0x10, 0x0e,
0x11, 0x00,
0x12, 0xf0,
0x13, 0x00,//ITU-656 standard mode
0x14, 0x04,
0x15, 0x15,/* VGATE start */ //改
0x16, 0x34,/* VGATE stop */
0x17, 0x5a,/* VGATE MSB and other values */
0x18, 0x40,
0x19, 0x80,
0x1a, 0x77,
0x1b, 0x42,
0x1c, 0x49,
0x1d, 0x01,
0x1e, 0x00,
0x1f, 0x00,
0x5a, 0x03,/* Vertical offset, standard 50hz value */
/* Task A */
0x90, 0x00,/* Task Handling Control */
0x91, 0x08,/* X-port formats/config */
0x92, 0x19,/* Input Ref. signal Def. */
0x93, 0x80,/* I-port config */
0x94, 0x40,/* hoffset low (input), 0x0002 is minimum */
0x95, 0x00,/* hoffset hi (input) */
0x96, 0xd0,/* hsize low (input), 0x02d0 = 720 */
0x97, 0x02,/* hsize hi (input) */
0x98, 0x10,/* voffset low (input) */
0x99, 0x00,/* voffset hi (input) */
0x9a, 0x20,/* vsize low (input), 0x120 = 288 */
0x9b, 0x01,/* vsize hi (input) */
0x9c, 0x68,/* hsize low (output), 0x0160 = 360 */
0x9d, 0x01,/* hsize hi (output) */
0x9e, 0x20,/* vsize low (output), 0x120 =288 */
0x9f, 0x01,/* vsize hi (output) */
0xa0, 0x02,
0xa1, 0x02,
0xa2, 0xaa,
0xa4, 0x80,
0xa5, 0x40,
0xa6, 0x40,
0xa8, 0x00,
0xa9, 0x04,
0xaa, 0x00,
0xac, 0x00,
0xad, 0x02,
0xae, 0x00,
0xb0, 0x00,
0xb1, 0x04,
0xb2, 0x00,
0xb3, 0x04,
0xb4, 0x00,
/* Task B */
0xc0, 0x00,/* Task Handling Control */
0xc1, 0x08,/* X-port formats/config */
0xc2, 0x19,/* Input Ref. signal Def. */
0xc3, 0xc0,/* I-port config */
0xc4, 0x04,/* hoffset low (input), 0x0002 is minimum. See comment at 0x94 above. */
0xc5, 0x00,/* hoffset hi (input) */
0xc6, 0xd0,/* hsize low (input), 0x02d0 = 720 */
0xc7, 0x02,/* hsize hi (input) */
0xc8, 0x10,/* voffset low (input), 0x10 = 16 */
0xc9, 0x00,/* voffset hi (input) */
0xca, 0x20,/* vsize low (input), 0x0120 = 288 */
0xcb, 0x01,/* vsize hi (input) */
0xcc, 0xd0,/* hsize low (output), 0x02d0 = 720 */
0xcd, 0x02,/* hsize hi (output) */
0xce, 0x20,/* vsize low (output), 0x0120 = 288 */
0xcf, 0x01,/* vsize hi (output) */
0xd0, 0x01,
0xd1, 0x00,
0xd2, 0x00,
0xd4, 0x80,
0xd5, 0x40,
0xd6, 0x40,
0xd8, 0x00,
0xd9, 0x04,
0xda, 0x00,
0xdc, 0x00,
0xdd, 0x02,
0xde, 0x00,
0xe0, 0x00,
0xe1, 0x04,
0xe2, 0x00,
0xe3, 0x04,
0xe4, 0x00,
0x88, 0xd0,/* reset scaler (was 0xD0) */
0x80, 0x20,/* Activate only task "B" */
0x88, 0xf0,/* activate scaler */
};

    for(i=0;i<218;i=i+2)
    {
    	if(!I2C_Write(saa7115_cfg_50hz_video[i+1],saa7115_cfg_50hz_video[i]))
    	return false;
    }
    return true;
}
#endif

⌨️ 快捷键说明

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