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

📄 .#main.c.1.21

📁 中芯微VC0528测试程序
💻 21
📖 第 1 页 / 共 2 页
字号:
/*************************************************************************/
/*									 */
/* The last modification date:  02-23-2004                               */
/* REMARKS:  Created initial version 1.0                                 */
/*                                                                       */
/*                Copyright (C) 2004 Vimicro CO.,LTD     		 */
/*************************************************************************/
#include <string.h>
#include "..\inc\44b.h"
#include "..\inc\option.h"
#include "..\inc\44blib.h"
#include "..\inc\timer.h"
#include "..\inc\serial.h"
#include "com.h"
#include "..\inc\panel.h"
//#include "..\inc\picture.h"
//#include "..\inc\bmp.h"
#include <stdio.h>
#include "..\..\vc0528rdk\vim_high_api.h"
#include "vc0528test.h"

#include "..\..\vc0528demo\inc\thin_usr.h"
#include "..\..\vc0528demo\inc\fat_thin.h"
/////////////////////////////////////////////////////////

UINT8 FastPreview;
volatile unsigned int err=0;
extern unsigned char *downPt;
extern unsigned int fileSize;
extern int Image$$RO$$Limit;
extern int Image$$RW$$Base;
extern UINT16 RGB_buf[240*320*2];
extern UINT8 YUVBuf[0x15000];
extern UINT8 BmpBuf[128*160*2];

void Isr_Init(void);
void __irq Uerror(void);
extern int Test_Cache(void);
extern void Init_CommandReceive(void);
extern void V5H_CommandDeal(void);
extern void 	InitTimer0ForCommandParase(void (*func)(),int interval);

extern void DrvInitInt(void);
extern UINT32 g_band;

extern UINT32 Get_UartRec(UINT8* ptr);
extern void Send_Uart(UINT8* pbDptr, UINT32 dNum);
extern void Test_Process(void);
extern  const unsigned char rgb64x48[6144];

extern void usb_isr(void);

void User_TimerProcess(unsigned long val)
{
	return;
}


void f_GetNowFileName(const char *Dir) 
{
	F_FIND FindFile;
	Uart_Printf("\n %s",Dir);
		f_chdir(Dir);
		if (!f_findfirst("*.*",&FindFile)) {
		do {
			Uart_Printf ("filename:%s",FindFile.filename);
				if (FindFile.attr&F_ATTR_DIR) {
			Uart_Printf ("directory\n");
		}
		else {
			Uart_Printf ("size %d\n",FindFile.filesize);
		}
		} while (!f_findnext(&FindFile));
		}	
}

void f_DelNowFileName(const char *Dir) 
{
	F_FIND FindFile;
	Uart_Printf("\n %s",Dir);
		f_chdir(Dir);
		if (!f_findfirst("*.*",&FindFile)) {
		do {
			Uart_Printf ("filename:%s",FindFile.filename);
			f_delete(FindFile.filename);
				if (FindFile.attr&F_ATTR_DIR) {
			Uart_Printf ("directory\n");
		}
		else {
			Uart_Printf ("size %d\n",FindFile.filesize);
		}
		} while (!f_findnext(&FindFile));
		}	
}
UINT8 g_UDiskExit=0;
UINT8  TCC_Register_LISR(int vector, void(*lisr_entry)(int),void (**old_lisr)(int))
{
	return 0;
}
UINT8 TCCE_Create_HISR(void *hisr, char *name,void (*hisr_entry)(void),
unsigned char  priority,void *stack_pointer,unsigned long  stack_size)
{
	return 0;
}
int TMSE_Create_Timer(void *timer, char *name,void (*expiration_routine)(unsigned long),unsigned long id, unsigned long initial_time,unsigned long reschedule_time,unsigned char  enable)
{
	return 0;
}
void TCCE_Activate_HISR(void *aaa)
{
	return;
}
void TMSE_Control_Timer(void *aaa,char a)
{
	return;
}
void Port_V5ChipReset()
{
	rPDATG = 0x7f;
	Delay(2000);
	rPDATG = 0xff;
	Delay(2000);
}
void V5HDEMO_FlushMLcdBypassRed(UINT16 *buf,UINT8 startx, UINT8 starty,UINT8 width, UINT16 height)
{
	UINT16 i,j;
	//V5H_WorkMode_Set(V5H_MODE_BYPASS);
	
	for(i=starty;i<(starty+height);i++)
	{//0x100=128pixel*(2byte/pixel)
	           *(volatile UINT16*)(0x8000000) = 0x0600;
		*(volatile UINT16*)(0x8000000) =startx; //start x
		 *(volatile UINT16*)(0x8000000) = 0x0700;
		 *(volatile UINT16*)(0x8000000) =i;
		
		for(j=startx;j<(startx+width);j++)
		{
			*(volatile UINT16*)(0x8000200) = 0xF800;//*buf++;	
			
		}
	}
}

void V5HDEMO_FlushMLcdBypassGreen(UINT16 *buf,UINT8 startx, UINT8 starty,UINT8 width, UINT16 height)
{
	UINT16 i,j;
	//V5H_WorkMode_Set(V5H_MODE_BYPASS);
	
	for(i=starty;i<(starty+height);i++)
	{//0x100=128pixel*(2byte/pixel)
	            *(volatile UINT16*)(0x8000000) = 0x0600;
		*(volatile UINT16*)(0x8000000) =startx; //start x
		 *(volatile UINT16*)(0x8000000) = 0x0700;
		 *(volatile UINT16*)(0x8000000) =i;
		for(j=startx;j<(startx+width);j++)
		{
			*(volatile UINT16*)(0x8000200) = 0x07f0;//*buf++;	
			
		}
	}
}

void V5HDEMO_FlushMLcdBypassBlue(UINT16 *buf,UINT8 startx, UINT8 starty,UINT8 width, UINT16 height)
{
	UINT16 i,j;
	//V5H_WorkMode_Set(V5H_MODE_BYPASS);
	
	for(i=starty;i<(starty+height);i++)
	{//0x100=128pixel*(2byte/pixel)
	        *(volatile UINT16*)(0x8000000) = 0x0600;
		*(volatile UINT16*)(0x8000000) =startx; //start x
		 *(volatile UINT16*)(0x8000000) = 0x0700;
		 *(volatile UINT16*)(0x8000000) =i;
		for(j=startx;j<(startx+width);j++)
		{
			*(volatile UINT16*)(0x8000200) = 0x001f;//*buf++;	
		}
	}
}

extern UINT32 Jpeg_Length;
 void testcapture(UINT16 Width,UINT16 height)
 {
char str[20];
UINT16 count=0xfff,Result;
F_FILE *fileid;
	Jpeg_Length=0;
	sprintf(str,"%dx%d.jpg",Width,height);
	fileid=f_open(str,"w+");//
	if(fileid==0)
		Uart_Printf("\n open error");
	else
		Result=VIM_HAPI_CaptureStill(VIM_HAPI_ROM_SAVE,fileid,0x160000,0);
	Beep(1);
	Delay(50);
	Beep(0);
	f_close(fileid);
	Jpeg_Length=VIM_HAPI_GetCaptureLength();
 }
 void testdisplay(UINT16 Width,UINT16 height)
 {
char str[20];
UINT16 count=0xfff,Result;
F_FILE *fileid;
	Jpeg_Length=0;

	sprintf(str,"%dx%d.jpg",Width,height);
	fileid=f_open(str,"r");//
	if(fileid==0)
		Uart_Printf("\n open error");
	else
		Result=VIM_HAPI_Display_Jpeg(VIM_HAPI_ROM_SAVE,fileid,0x160000,0,0,128,160);
	Beep(1);
	Delay(50);
	Beep(0);
	f_close(fileid);
	



 }
extern void NAND_Erease(void);
void FATFileSystemInit(void)
{
F_FIND FindFile;
#if 0
	unsigned char ret;
f_initvolume();
		ret = f_hardformat(F_FAT16_MEDIA);
		if (ret == 0)
			Uart_Printf("\nfomat success.");
		else
			Uart_Printf("\nfomat fail.");
		
		f_initvolume();	//Initialize Hardware For Filesystem
#else
	unsigned char ret;
	if(f_initvolume()==0)
	{
		Uart_Printf("\nKM29U128T is  found and have been fomat.");
		f_mkdir("/pic");
	}
	else if(f_initvolume()==2)
	{
		Uart_Printf("\nKM29U128T is  found and have not been fomat.");
		NAND_Erease();  
		f_initvolume();
		ret = f_hardformat(2);//16 
		if (ret == 0)
			Uart_Printf("\nfomat success.");
		else
			Uart_Printf("\nfomat fail.");
		
		f_initvolume();	//Initialize Hardware For Filesystem
		f_mkdir("/pic");
		
	}
	else 
	{
		Uart_Printf("\nKM29U128T is not  found .");
	}

	f_GetNowFileName("."); //当前目录
	f_chdir("/PIC");
	f_DelNowFileName("."); //delete pic
#endif	
}
extern  unsigned char const BMP2[];
extern  unsigned char const BMP8[];
extern  unsigned char const BMP6[];

extern UINT8 BmpBuf[128*160*2];
extern unsigned char JPEG_128x160_422[3072];
extern unsigned char data128x96[3661];
extern unsigned char data128x128[4988] ;
UINT8 g_Reverse=0;
UINT8 g_DemoFlage=0;
extern void InitMalloc(void);
 void Init_Key(void)
 	{
 	}
 extern unsigned char data320x240[7432] ;
void Main(void)
{
	UINT32 i;
	UINT16 value16;//VIM_SIF_I2cReadByte(Command_para[0], &value16);
//UINT8 STR[20],STR1[20];
//UINT16 SizeX,SizeY;
	UINT8 temp;

	rSYSCFG=CACHECFG;	// Using 8KB Cache//

	Port_Init();
	rIISCON=0x0f;//start iis    clk to 568 start
	
	Isr_Init();

#if 1//V558_BUS_TYPE == V558_BUS_MULTI16
	Mem_Init(1);
#else
	Mem_Init(0);
#endif

//--initial arm clock and uart baudrate----------------------
	//CLock_Init(12000000,57600);
	//CLock_Init(19200000,57600);
	//CLock_Init(12000000,57600);
	//CLock_Init(26000000,57600);
	
	CLock_Init(24000000,115200);
	Init_CommandReceive();
//------------------------------------

 	ArmInitInt();				// EINT Initialize	//angela

	Led_Display(0xf);
	Delay(0);
	downPt=(unsigned char *)DOWNLOAD_ADDRESS;

	/*	Cache test	*/
	if(Test_Cache())
		Uart_Printf("\nCache Test:OK!");
	else
		Uart_Printf("\nCache Test:FAIL!");

	Beep(0x1);
	Uart_Select(0); //Select UART0//
	Beep(0x0);
	Led_Display(0x0);
	Port_V5ChipReset();
	Com_Init(Get_UartRec, Send_Uart); 
	//InitMalloc();
	//usb init
	//mass storage init
	if(NandFlash_Init())
	{
		Uart_Printf("flash ok \n");
		//NAND_Erease();
		//f_dotest(0);
		FATFileSystemInit();
		//MassStorage_Init();
		//f_witefile();
		f_chdir("/pic");
		Uart_Printf("f_dotest() end \n");
	}
	else 
		Uart_Printf("flash error \n");

	value16=VIM_HAPI_InitVc05x();
	if(value16)
		Uart_Printf("\nVIM_HAPI_InitVc0578 error =%d\n",value16);
	else
		Uart_Printf("\nVIM_HAPI_InitVc0578 ok \n");

	//Port_V5ChipReset();
	
	//VIM_HAPI_SetWorkMode(VIM_HAPI_MODE_CAMERAON);//through mode power on lcd
	
	//VIM_HAPI_SetWorkMode(VIM_HAPI_MODE_BYPASS);//through mode power on lcd
	//VIM_HAPI_SetWorkMode(VIM_HAPI_MODE_CAMERAON);//through mode power on lcd
	
	InitMalloc();
	Lcd_MPanel_SetList(&(MLcdParm.poweron));

	/*Lcd_MPanel_Bypass_Display(00, 00, 132, 132,0xffff );			//white		
	Delay(100);
	Lcd_MPanel_Bypass_Display(00, 00, 132, 132,0x0000 );			//black
	Delay(100);
	Lcd_MPanel_Bypass_Display(00, 00, 132, 132,0x07e0 );			//green
	Delay(100);
	Lcd_MPanel_Bypass_Display(00, 00, 132, 132,0x001f );			//blue
	Delay(100);
	Lcd_MPanel_Bypass_Display(00, 00, 132, 132,0xf800 );			//red
*/


⌨️ 快捷键说明

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