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

📄 sysc.c

📁 s3c6400 ADS下官方测试程序
💻 C
📖 第 1 页 / 共 4 页
字号:

	uRegValue =Inp32(rOTHERS);
       uRegValue |= (1<<12);
       Outp32(rOTHERS, uRegValue);
		
}






//////////
// Function Name : SYSC_RdRSTSTAT
// Function Description : This function read Rest Status Register
//				  
// Input : NONE		  	
//							  
// Output : Status Value
// Version : 
u32 SYSC_RdRSTSTAT(u32 uPRINT)
{
	u32 uRegValue;
	u32 uRstId;

	uRegValue =Inp32(rRST_STAT);

	if(uPRINT == 1)
	printf("Reset Status Register:	0x%x\n",  uRegValue);

	if( uRegValue & (1<<0))
	{
		if(uPRINT == 1)
		printf("External reset by XnRESET  \n\n");
		uRstId = 0;
	}
	else if (uRegValue & (1<<1))
	{
		if(uPRINT == 1)
		printf("Warm reset by XnWRESET \n\n");
		uRstId = 1;
		
	}
	else if (uRegValue & (1<<2))
	{
		if(uPRINT == 1)
		printf("Watch dog timer reset by WDTRST\n\n");
		uRstId = 2;
		
	}
	else if (uRegValue & (1<<3))
	{
		if(uPRINT == 1)
		printf("Reset by SLEEP Mode Wake-up \n\n");
		uRstId = 3;
		
	}
	else if (uRegValue & (1<<4))
	{
		if(uPRINT == 1)
		printf("Reset by ESLEEP mode Wake-up \n\n");
		uRstId = 4;
	}
	else if (uRegValue & (1<<5))
	{
		if(uPRINT == 1)
		printf("Software reset by SWRESET\n\n");
		uRstId = 5;		
	}	

	return uRstId;
}

//////////
// Function Name : SYSC_RdBLKPWR
// Function Description : This function read Block Power Status Register
//				  
// Input : 		  	
//							  
// Output : NONE
// Version : 
void SYSC_RdBLKPWR(void)
{
	u32 uRegValue;

	uRegValue =Inp32(rBLK_PWR_STAT);
	printf("Block Power Status Register	0x%x\n",  uRegValue);
#if 0
	printf("Block Top Power	%d\n",  uRegValue&(0x1<<0));
	printf("Block V    Power	%d\n",  (uRegValue&(0x1<<1))>>1);
	printf("Block I	    Power	%d\n",  (uRegValue&(0x1<<2))>>2);	
	printf("Block P    Power	%d\n",  (uRegValue&(0x1<<3))>>3);	
	printf("Block F	    Power	%d\n",  (uRegValue&(0x1<<4))>>4);	
	printf("Block S    Power	%d\n",  (uRegValue&(0x1<<5))>>5);	
	printf("Block ETM    Power	%d\n",  (uRegValue&(0x1<<6))>>6);	
#endif		
}


//////////
// Function Name : SYSC_ClrWKUPSTAT
// Function Description : This function clear Wake-up Status Register
//				  
// Input : 		  	
//							  
// Output : NONE
// Version : 
void SYSC_ClrWKUPSTAT(void)
{
	u32 uRegValue;

	uRegValue =Inp32(rWAKEUP_STAT);

	printf("Wake-up Status Register:	0x%x\n",  uRegValue);

	if( uRegValue & (1<<0))
	{
		printf("___ Wake-up by EINT  \n");
		uRegValue |= (1<<0);
		Outp32(rWAKEUP_STAT,uRegValue);
	}
	else if (uRegValue & (1<<1))
	{
		printf("___ Wake-up by RTC ALARM  \n");
		uRegValue |= (1<<1);
		Outp32(rWAKEUP_STAT,uRegValue);
	}		
	else if (uRegValue & (1<<2))
	{
		printf("___ Wake-up by RTC Tick  \n");
		uRegValue |= (1<<2);
		Outp32(rWAKEUP_STAT,uRegValue);
	}
	else if (uRegValue & (1<<3))
	{
		printf("___ Wake-up by Touch Screen  \n");
		uRegValue |= (1<<3);
		Outp32(rWAKEUP_STAT,uRegValue);
	}
	else if (uRegValue & (1<<4))
	{
		printf("___ Wake-up by KeyPad   \n");
		uRegValue |= (1<<4);
		Outp32(rWAKEUP_STAT,uRegValue);
	}
	else if (uRegValue & (1<<5))
	{
		printf("___ Wake-up by MSM Modem  \n");
		uRegValue |= (1<<5);
		Outp32(rWAKEUP_STAT,uRegValue);
	}
	else if (uRegValue & (1<<6))
	{
		printf("___ Wake-up by BATFLT  \n");
		uRegValue |= (1<<6);
		Outp32(rWAKEUP_STAT,uRegValue);
	}
	else if (uRegValue & (1<<7))
	{
		printf("___ Wake-up by Warm Reset  \n");
		uRegValue |= (1<<7);
		Outp32(rWAKEUP_STAT,uRegValue);
	}
	else if (uRegValue & (1<<8))
	{
		printf("___ Wake-up by HSI  \n");
		uRegValue |= (1<<8);
		Outp32(rWAKEUP_STAT,uRegValue);
	}		
	else if (uRegValue & (1<<9))
	{
		printf("___ Wake-up by MMC0  \n");
		uRegValue |= (1<<9);
		Outp32(rWAKEUP_STAT,uRegValue);
	}	
	else if (uRegValue & (1<<10))
	{
		printf("___ Wake-up by MMC1  \n");
		uRegValue |= (1<<10);
		Outp32(rWAKEUP_STAT,uRegValue);
	}	
		else if (uRegValue & (1<<11))
	{
		printf("___ Wake-up by MMC2  \n");
		uRegValue |= (1<<11);
		Outp32(rWAKEUP_STAT,uRegValue);
	}
}


//////////
// Function Name : LTC3714_VoltageSet 
// Function Description : CLKGate_Test in the Normal Mode 
// Input : 					uPwr : 1:  ARM Voltage Control,  2: Internal Voltage Control, 3: Both Voltage Control
//							uVoltage :  1mV 
// Output :	None 
// Version : v0.1
void LTC3714_VoltageSet(u32 uPwr, u32 uVoltage)  
{

     int uvtg, uRegValue;
	//////////////////////////////////////////////
	// GPN15  GPN14 GNP13 GPN12 GPN11
	//  VID4    VID3   VID2    VID1   VID0		// Voltage
	
	//	0	 0	  0 	0	 0		// 1.75V
	//	0	 0	  0 	0	 1		// 1.70V
	//	0	 0	  0 	1	 0		// 1.65V
	//	0	 0	  0 	1	 1		// 1.60V
	//	0	 0	  1 	0	 0		// 1.55V
	//	0	 0	  1 	0	 1		// 1.50V
	//	0	 0	  1 	1	 0		// 1.45V
	//	0	 0	  1 	1	 1		// 1.40V
	//	0	 1	  0 	0	 0		// 1.35V
	//	0	 1	  0 	0	 1		// 1.30V
	//	0	 1	  0 	1	 0		// 1.25V
	//	0	 1	  0 	1	 1		// 1.20V
	//	0	 1	  1 	0	 0		// 1.15V
	//	0	 1	  1 	0	 1		// 1.10V
	//	0	 1	  1 	1	 0		// 1.05V
	//	0	 1	  1 	1	 1		// 1.00V
	//   1	 0      0   0       0		// 0.975V
	//	1	 0	  0 	0	 1		// 0.950V
	//    1      0      0   1       0           // 0.925V
	//	1	 0	  0 	1	 1		// 0.900V
	//    1      0      1   0       0           // 0.875V
	//	1	 0	  1 	0	 1		// 0.850V
	//    1      0      1   1       0          //  0.825V
	//	1	 0	  1 	1	 1		// 0.800V
	//    1      1      0   0       0          //  0.775V
	//    1      1      0   0       1          //  0.750V
	//    1      1      0   1       0          //  0.725V
	//    1      1      0    1      1          //  0.700V
	//    1      1      1    0      0          //  0.675V
	//    1      1      1    0      1          //  0.650V
	//    1      1      1    1      0          //  0.625V
	//    1      1      1    1      1          //  0.600V
	
   	uvtg=uVoltage;

	//GPIO Setting - For LTC3714 VID
	GPIO_SetFunctionEach(eGPIO_N, eGPIO_11, 1);		//XEINT11(VID0) as Output
	GPIO_SetFunctionEach(eGPIO_N, eGPIO_12, 1);		//XEINT12(VID1) as Output
	GPIO_SetFunctionEach(eGPIO_N, eGPIO_13, 1);		//XEINT13(VID2) as Output
	GPIO_SetFunctionEach(eGPIO_N, eGPIO_14, 1);		//XEINT14(VID3) as Output
	GPIO_SetFunctionEach(eGPIO_N, eGPIO_15, 1);		//XEINT11(VID4) as Output

	GPIO_SetPullUpDownEach(eGPIO_N, eGPIO_11, 0);	// Pull-up/dn disable
	GPIO_SetPullUpDownEach(eGPIO_N, eGPIO_12, 0);
	GPIO_SetPullUpDownEach(eGPIO_N, eGPIO_13, 0);
	GPIO_SetPullUpDownEach(eGPIO_N, eGPIO_14, 0);
	GPIO_SetPullUpDownEach(eGPIO_N, eGPIO_15, 0);


	// Latch Control Signal 
	// CORE_REG_OE: XhiA9(GPL9),  ARM_REG_LE: XhiA8(GPL8), INT_REG_LE: XhiA10(GPL10)
	GPIO_SetFunctionEach(eGPIO_L, eGPIO_8, 1);		//XhiA8(ARM_REG_LE) as Output
	GPIO_SetFunctionEach(eGPIO_L, eGPIO_9, 1);		//XhiA9(CORE_REG_OE) as Output
	GPIO_SetFunctionEach(eGPIO_L, eGPIO_10,1);		//XhiA10(INT_REG_LE)as Output

	GPIO_SetPullUpDownEach(eGPIO_L, eGPIO_8, 0);	// Pull-up/dn disable
	GPIO_SetPullUpDownEach(eGPIO_L, eGPIO_9, 0);
	GPIO_SetPullUpDownEach(eGPIO_L, eGPIO_10, 0);
		
	
       uRegValue = Inp32(0x7F008834);					// GPNDAT Register

   

    switch (uvtg)
	{
	case 1750:
	      uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(0<<14)|(0<<13)|(0<<12)|(0<<11));	//D4~0
	      break;

	case 1700:
	     uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(0<<14)|(0<<13)|(0<<12)|(1<<11));	//D4~0
	      break;

	case 1650:
		 uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(0<<14)|(0<<13)|(1<<12)|(0<<11));	//D4~0
		 break;
       
	case 1600:
		uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(0<<14)|(0<<13)|(1<<12)|(1<<11));	//D4~0
		break;

	case 1550:
		 uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(0<<14)|(1<<13)|(0<<12)|(0<<11));	//D4~0
		 break;

	case 1500:
		uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(0<<14)|(1<<13)|(0<<12)|(1<<11));	//D4~0
		 break;

	case 1450:
		uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(0<<14)|(1<<13)|(1<<12)|(0<<11));	//D4~0
		 break;

	case 1400:
		 uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(0<<14)|(1<<13)|(1<<12)|(1<<11));	//D4~0
		 break;

	case 1350:
	      uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(1<<14)|(0<<13)|(0<<12)|(0<<11));	//D4~0
	      break;

	case 1300:
		 uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(1<<14)|(0<<13)|(0<<12)|(1<<11));	//D4~0
		 break;
       
	case 1250:
		uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(1<<14)|(0<<13)|(1<<12)|(0<<11));	//D4~0
		break;

	case 1200:
		 uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(1<<14)|(0<<13)|(1<<12)|(1<<11));	//D4~0
		 break;

	case 1150:
		uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(1<<14)|(1<<13)|(0<<12)|(0<<11));	//D4~0
		 break;

	case 1100:
		 uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(1<<14)|(1<<13)|(0<<12)|(1<<11));	//D4~0
		 break;

	case 1050:
		 uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(1<<14)|(1<<13)|(1<<12)|(0<<11));	//D4~0
		 break;

	case 1000:
		 uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11));	//D4~0
		break;

	case 975:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(0<<14)|(0<<13)|(0<<12)|(0<<11));	//D4~0
		 break;

	case 950:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(0<<14)|(0<<13)|(0<<12)|(1<<11));	//D4~0
		 break;
		 
	case 925:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(0<<14)|(0<<13)|(1<<12)|(0<<11));	//D4~0
		 break;
		 
	case 900:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(0<<14)|(0<<13)|(1<<12)|(1<<11));	//D4~0
		 break;		 

	case 875:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(0<<14)|(1<<13)|(0<<12)|(0<<11));	//D4~0
		 break;

	case 850:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(0<<14)|(1<<13)|(0<<12)|(1<<11));	//D4~0
		 break;

	case 825:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(0<<14)|(1<<13)|(1<<12)|(0<<11));	//D4~0
		 break;

	case 800:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(0<<14)|(1<<13)|(1<<12)|(1<<11));	//D4~0
		 break;

	case 775:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(1<<14)|(0<<13)|(0<<12)|(0<<11));	//D4~0
		 break;

	case 750:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(1<<14)|(0<<13)|(0<<12)|(1<<11));	//D4~0
		 break;

	case 725:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(1<<14)|(0<<13)|(1<<12)|(0<<11));	//D4~0
		 break;
		 
	case 700:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(1<<14)|(0<<13)|(1<<12)|(1<<11));	//D4~0
		 break;

	case 675:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(1<<14)|(1<<13)|(0<<12)|(0<<11));	//D4~0
		 break;		 

	case 650:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(1<<14)|(1<<13)|(0<<12)|(1<<11));	//D4~0
		 break;

	case 625:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(1<<14)|(1<<13)|(1<<12)|(0<<11));	//D4~0
		 break;

	case 600:
		uRegValue=(uRegValue&~(0x1f<<11))|((1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11));	//D4~0
		 break;
 
    default:	// 1.00V
		uRegValue=(uRegValue&~(0x1f<<11))|((0<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11));	//D4~0
		 break;	 		
	}
	
	printf("uRegValue(VID_Data) 0x%x\n", uRegValue);

	// Control Data 
	Outp32(0x7F008834,uRegValue);

	if(uPwr == 1 )		//ARM Voltage Control => ARM_REG_LE => Output H => Data Changed
	{
		GPIO_SetDataEach(eGPIO_L, eGPIO_8, 1);
		printf("ARM REG LE\n");
	}
	else if(uPwr == 2 )	// INT Voltage Control
	{
		GPIO_SetDataEach(eGPIO_L, eGPIO_10, 1);
		printf("INT REG LE\n");
	}
	else if (uPwr== 3) 	// Both Voltage Control
	{
		GPIO_SetDataEach(eGPIO_L, eGPIO_8, 1);
		GPIO_SetDataEach(eGPIO_L, eGPIO_10, 1);
			
		//printf("ARM&INT REG LE\n");
		//while(!UART_GetKey());
		
	}

	// Output Enable
	GPIO_SetDataEach(eGPIO_L, eGPIO_9, 1);

    printf("Latch Out Enable\n");
    //while(!UART_GetKey());
	Delay(100);

	GPIO_SetDataEach(eGPIO_L, eGPIO_8, 0);		// Latch Disable
	GPIO_SetDataEach(eGPIO_L, eGPIO_10,0);		// Latch Disable
	

}

⌨️ 快捷键说明

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