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

📄 main.c

📁 the programmer for samsung s 2410, it s for LCD controler
💻 C
字号:
#include "..\common\option.h"
#include "..\common\def.h"
#include "..\common\2410addr.h"
#include "..\common\2410slib.h"
#include "..\common\2410lib.h"
#include "..\common\2410addr.h"
//#include "..\common\k9s1208.h"
#include "..\common\register.h"
#include "..\common\LCD.h"
#include "..\common\LCDlib.h"

#define DOWNLOAD_ADDRESS _RAM_STARTADDRESS
#define BOOT_IMAGE_SIZE 5 
#define MEM_OFFSET    0x01000000

void (*run)(void)=(void (*)(void))(DOWNLOAD_ADDRESS+MEM_OFFSET);
void Port_Init(void);
void Led_Display(int);
void Delay(int);
void _Link(void);

volatile unsigned char *downPt;

void Main(int argc,char **argv)
{/*
	int i,j;
	char status=0;
	char *p;
	downPt=(unsigned char *)(DOWNLOAD_ADDRESS+MEM_OFFSET);

	MMU_DisableICache();
	MMU_DisableDCache();

	ChangeClockDivider(1,1);	    // 1:2:4
	ChangeMPllValue(M_MDIV,M_PDIV,M_SDIV);  //Fin=12MHz FCLK=200MHz
	Port_Init();
	Uart_Select(0);
	Uart_Init(PCLK, 115200);
   //_Link();

 	//Lcd_Init(MODE_TFT_16BIT_640480);
	//Test_Lcd_Tft_16Bit_640480();
    //Test_Lcd_Tft_16Bit_640480_Hwswp();
    
	Lcd_InitZK();
    Lcd_Test();//640x480
    Delay(100);
    //Lcd_InitZK_End();
*/
	/*********************************************************
	 *  on(led1) -> on(led2) -> on(led3) -> on(led4)
	 ********************************************************/
/*	Embest();
	Uart_SendString("\n\n S3C2410 Test in Embest IDE for ARM toolkets. \n");
	Uart_SendString(  "  UART Send OK! \n ");

    while(1)
     {
       if(status<5) status +=1;
       else status =1;
       Led_Display(status);
       for(i=0;i<55500;i++) // 55500
        {;}
       for(i=0;i<55500;i++) // 55500
        {;}
        
      }
 */   
 
 /////////////////////////////////////////////
 unsigned int *pIC[2];
	pIC[0] = (unsigned int *)0x30200000; 
	pIC[1] = (unsigned int *)0x30217000; 
	//pIC[0] = (uint8*)0x30200000; 
	//pIC[1] = (uint8*)0x30217000; 

	signed char	Gbr[361] = { 
	0, 	0, 	0, 	0, 	0, 	0, 	0, 	0, 	0, 	10, 	0, 	0, 	0, 	0, 	0, 	0, 	0, 	0, 	0, 	
	0, 	0, 	0, 	0, 	0, 	11, 	11, 	12, 	13, 	13, 	13, 	12, 	11, 	11, 	0, 	0, 	0, 	0, 	0, 	
	0, 	0, 	0, 	0, 	3, 	4, 	4, 	4, 	4, 	4, 	4, 	4, 	4, 	4, 	3, 	0, 	0, 	0, 	0, 	
	0, 	0, 	0, 	-13, 	-15, 	-17, 	-18, 	-19, 	-20, 	-20, 	-20, 	-19, 	-18, 	-17, 	-15, 	-13, 	0, 	0, 	0, 	
	0, 	0, 	-32, 	-37, 	-41, 	-45, 	-49, 	-52, 	-54, 	-54, 	-54, 	-52, 	-49, 	-45, 	-41, 	-37, 	-32, 	0, 	0, 	
	0, 	-36, 	-42, 	-49, 	-55, 	-60, 	-65, 	-69, 	-71, 	-72, 	-71, 	-69, 	-65, 	-60, 	-55, 	-49, 	-42, 	-36, 	0, 	
	0, 	-23, 	-28, 	-32, 	-36, 	-40, 	-43, 	-45, 	-47, 	-47, 	-47, 	-45, 	-43, 	-40, 	-36, 	-32, 	-28, 	-23, 	0, 	
	0, 	9, 	11, 	13, 	14, 	16, 	17, 	18, 	19, 	19, 	19, 	18, 	17, 	16, 	14, 	13, 	11, 	9, 	0, 	
	0, 	47, 	55, 	63, 	71, 	79, 	85, 	90, 	93, 	94, 	93, 	90, 	85, 	79, 	71, 	63, 	55, 	47, 	0, 	
	52, 	63, 	74, 	86, 	96, 	106, 	115, 	121, 	125, 	127, 	125, 	121, 	115, 	106, 	96, 	86, 	74, 	63, 	52, 	
	0, 	47, 	55, 	63, 	71, 	79, 	85, 	90, 	93, 	94, 	93, 	90, 	85, 	79, 	71, 	63, 	55, 	47, 	0, 	
	0, 	9, 	11, 	13, 	14, 	16, 	17, 	18, 	19, 	19, 	19, 	18, 	17, 	16, 	14, 	13, 	11, 	9, 	0, 	
	0, 	-23, 	-28, 	-32, 	-36, 	-40, 	-43, 	-45, 	-47, 	-47, 	-47, 	-45, 	-43, 	-40, 	-36, 	-32, 	-28, 	-23, 	0, 	
	0, 	-36, 	-42, 	-49, 	-55, 	-60, 	-65, 	-69, 	-71, 	-72, 	-71, 	-69, 	-65, 	-60, 	-55, 	-49, 	-42, 	-36, 	0, 	
	0, 	0, 	-32, 	-37, 	-41, 	-45, 	-49, 	-52, 	-54, 	-54, 	-54, 	-52, 	-49, 	-45, 	-41, 	-37, 	-32, 	0, 	0, 	
	0, 	0, 	0, 	-13, 	-15, 	-17, 	-18, 	-19, 	-20, 	-20, 	-20, 	-19, 	-18, 	-17, 	-15, 	-13, 	0, 	0, 	0, 	
	0, 	0, 	0, 	0, 	3, 	4, 	4, 	4, 	4, 	4, 	4, 	4, 	4, 	4, 	3, 	0, 	0, 	0, 	0, 	
	0, 	0, 	0, 	0, 	0, 	11, 	11, 	12, 	13, 	13, 	13, 	12, 	11, 	11, 	0, 	0, 	0, 	0, 	0, 	
	0, 	0, 	0, 	0, 	0, 	0, 	0, 	0, 	0, 	10, 	0, 	0, 	0, 	0, 	0, 	0, 	0, 	0, 	0
	}; 	
	long	lTmp; 
	unsigned char	m, n;
	unsigned char	*pcT, *pcEnh, *pcSrc, cPltM=18; 
	signed char		*pcGbrT;
	unsigned short	i, j, sPltS=361, sStep=237, sOfst=4883; 

	char status=0;
	char *p;

///////////////////////////////////TEST LED//////////////
    while(1)
     {
       if(status<5) status +=1;
       else status =1;
       Led_Display(status);
       for(i=0;i<55500;i++)
        {;}
       for(i=0;i<55500;i++)
        {;}
        
      }


////////////////////////////////////ENABLE CACHE//////////
	MMU_EnableICache();
	MMU_EnableDCache();	
	pcSrc = pIC[0]; 
	pcEnh = pIC[1]; 
////////////////////CHANGE CLOCK///////////////////	/////////

ChangeClockDivider(1,1);	    // 1:2:4
	ChangeMPllValue(M_MDIV,M_PDIV,M_SDIV);  //Fin=12MHz FCLK=200MHz

//////////////////////RUN ONCE/////////////////////////
	
	
	for(i=0; i<342; i++,pcEnh+=cPltM,pcSrc+=cPltM) { 
		for(j=0; j<238; j++,pcEnh++,pcSrc++) { 
			pcT = pcSrc;
			pcGbrT = &Gbr[0];
			lTmp = 0;
			for(m=0; m<19; m++,pcT+=sStep) {
				for(n=0; n<19; n++,pcGbrT++,pcT++) { 
					//if(*pcGbrT != 0) 
						lTmp += *pcGbrT**pcT;
				}
			}
			lTmp = (unsigned char)(((lTmp/sPltS)>>5)+128); 
			*pcEnh = lTmp; 
		}
	} 
///////////////////////////RUN SECOND///////////////////////////////////
	for(i=0; i<342; i++,pcEnh+=cPltM,pcSrc+=cPltM) { 
		for(j=0; j<238; j++,pcEnh++,pcSrc++) { 
			pcT = pcSrc;
			pcGbrT = &Gbr[0];
			lTmp = 0;
			for(m=0; m<19; m++,pcT+=sStep) {
				for(n=0; n<19; n++,pcGbrT++,pcT++) { 
					//if(*pcGbrT != 0) 
						lTmp += *pcGbrT**pcT;
				}
			}
			lTmp = (unsigned char)(((lTmp/sPltS)>>5)+128); 
			*pcEnh = lTmp; 
		}
	} 
	  
 //////////////////////TEST LED ////////////////
    while(1)
     {
       if(status<5) status +=1;
       else status =1;
       Led_Display(status);
       for(i=0;i<55500;i++)
        {;}
       for(i=0;i<55500;i++)
        {;}
        
      }
 }
void __gccmain(void)
{
}

⌨️ 快捷键说明

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