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

📄 triton_int_test.c

📁 OMAP1030 处理器的ARM 侧硬件测试代码 OMAP1030 是TI的双核处理器
💻 C
字号:





#include "triton_int_test.h"
#include "UART_irDA.h"





int Triton_int_test(void)
{
  
  /* Triton INT sources #*/
#define CHARGE_STOP 0
#define VBUS_PRECHG 1
#define BCI_WATCHDOG 2
#define MADC1 3
#define MADC2 4
#define CARKIT 5
#define SIMCD 6
#define PWON 7
#define RPWON 8
#define VAC 9
#define RTC 10
#define VBATLOW 11
#define VBUS 12
#define HOTDIE 13
#define HOOKDET 14
#define HSDET 15
#define UNKNOWN 99
  
  int state_p1,state_p2,state_p3;
  
  UWORD8 read_value,int2_reg_lsb,int2_reg_msb;
  
  /* to access to the page of the Abb module MASTER */



  triton_sim_detect_enable();
  
  MSI2C_AccessPage(PMC_MASTER_page);
  
  /* read START_MODE bit (PB_CFG_TEST) to know if start by TESTRESET */
  read_value = MSI2C_MasterPollingReceiveAbb(PMC_MASTER_PB_CFG_TEST);
  read_value = (read_value >> 7) & 0x01;
  if (read_value == 1) UART_Printf(UART2,"TESTRESET start \r\n");
  
  /* read SEQ_P123_STATE to know the current state of each sequencer */
  read_value = MSI2C_MasterPollingReceiveAbb(PMC_MASTER_SEQ_P123_STATE);
  state_p1 = read_value & 0x03;
  state_p2 = (read_value >> 2) & 0x03;
  state_p3 = (read_value >> 4) & 0x03;
  
  /* read INT2_P1_STS_A and INT2_P1_STS_B
  // to access to the page of the Abb module INT2 */
    MSI2C_AccessPage(INT2_page);  
    int2_reg_lsb = MSI2C_MasterPollingReceiveAbb(INT2_IT2STATUSP1L);
    int2_reg_msb = MSI2C_MasterPollingReceiveAbb(INT2_IT2STATUSP1H);
    /* to access to the page of the Abb module MASTER */
    MSI2C_AccessPage(PMC_MASTER_page);
    
    UART_Printf(UART2,"\r\nP1 state P2 state P3 state \r\n");  
 
    switch(state_p1)
      {
      case 0x0: UART_Printf(UART2,"OFF      "); break;
      case 0x1: UART_Printf(UART2,"RESERVED ");break; 
      case 0x2: UART_Printf(UART2,"SLEEP    ");  break;
      case 0x3: UART_Printf(UART2,"ACTIVE   "); break;
      default :
	break;
      }
    
    switch(state_p2)
      {
      case 0x0: UART_Printf(UART2,"OFF      "); break;
      case 0x1: UART_Printf(UART2,"RESERVED ");break; 
      case 0x2: UART_Printf(UART2,"SLEEP    ");  break;
      case 0x3: UART_Printf(UART2,"ACTIVE   "); break;
      default :
	break;
      } 
    
    switch(state_p3)
      {
      case 0x0: UART_Printf(UART2,"OFF      "); break;
      case 0x1: UART_Printf(UART2,"RESERVED ");break; 
      case 0x2: UART_Printf(UART2,"SLEEP ");  break;
      case 0x3: UART_Printf(UART2,"ACTIVE "); break;
      default :
	break;
      }      
   
    UART_Printf(UART2,"\r\n"); 
    
    if ((int2_reg_lsb>>7) && 0x01) 
      {
	UART_Printf(UART2,"\r\n PWON low detected \r\n");
	return(PWON);
      }
    
    if ((int2_reg_lsb>>6) && 0x01)
      { 
	UART_Printf(UART2,"\r\n SIMCD event detected \r\n");
	return(SIMCD);
      }
    if ((int2_reg_lsb>>5) && 0x01) 
      {
	UART_Printf(UART2,"\r\n CARKIT event detected \r\n");
	return(CARKIT);
      }
    if ((int2_reg_lsb>>4) && 0x01) 
      {
	UART_Printf(UART2,"\r\n MADC conversion from P2 \r\n");	
	return(MADC2);
      }
    if ((int2_reg_lsb>>3) && 0x01)
      {
	UART_Printf(UART2,"\r\n MADC conversion from P1 \r\n");
	return(MADC1);
      }
    if ((int2_reg_lsb>>2) && 0x01)
      {
	UART_Printf(UART2,"\r\n BCI watchdog \r\n");
	return(BCI_WATCHDOG);
      }
    if ((int2_reg_lsb>>1) && 0x01)
      {
	UART_Printf(UART2,"\r\n VBUS precharge \r\n");
	return(VBUS_PRECHG);
      }
    if (int2_reg_lsb && 0x01)
      {
	UART_Printf(UART2,"\r\n CHARGE stop \r\n");
	return(CHARGE_STOP);
      }
    if ((int2_reg_msb>>7) && 0x01) 
      {
	UART_Printf(UART2,"\r\n HEADSET detected \r\n");
	 MSI2C_MasterPollingSendAbb(INT2_IT2MASKP1L,0x80);
//    MSI2C_MasterPollingSendAbb(INT2_IT2MASKP1L,0x00);
	return(HSDET);
      }
    if ((int2_reg_msb>>6) && 0x01)
      {
	UART_Printf(UART2,"\r\n HOOK press detected \r\n");
	return(HOOKDET);
      }
    if ((int2_reg_msb>>5) && 0x01)
      {	
	UART_Printf(UART2,"\r\n HOTDIE condition \r\n");
	return(HOTDIE);
      }
    if ((int2_reg_msb>>4) && 0x01) 
      {
	UART_Printf(UART2,"\r\n VBUS event detected ");
	read_value = MSI2C_MasterPollingReceiveAbb(PMC_MASTER_STS_HW_CONDITIONS);
	read_value =((read_value>>3) & 0x01);
	if (read_value) UART_Printf(UART2,"\r\n HIGH \r\n");
	else UART_Printf(UART2,"\r\n LOW \r\n");
	return(VBUS);
      }
    if ((int2_reg_msb>>3) && 0x01) 
      {
	UART_Printf(UART2,"\r\n VBATLOW condition detected \r\n");
	return(VBATLOW);
      }
    if ((int2_reg_msb>>2) && 0x01) 
      {
	UART_Printf(UART2,"\r\n RTC event detected \r\n");
	return(RTC);
      }
    if ((int2_reg_msb>>1) && 0x01) 
      {
	UART_Printf(UART2,"\r\n VAC event detected ");
	read_value = MSI2C_MasterPollingReceiveAbb(PMC_MASTER_STS_HW_CONDITIONS);
	read_value =((read_value>>2) & 0x01);
	if (read_value) UART_Printf(UART2,"\r\n HIGH \r\n");
	else UART_Printf(UART2,"\r\n LOW \r\n");
	return(VAC);
      }
    if (int2_reg_msb && 0x01) 
      {
	UART_Printf(UART2,"\r\n RPWON event detected ");
	read_value = MSI2C_MasterPollingReceiveAbb(PMC_MASTER_STS_HW_CONDITIONS);
	read_value =((read_value>>1) & 0x01);
	if (read_value) UART_Printf(UART2,"LOW \r\n");
	else UART_Printf(UART2," HIGH \r\n");
	return(RPWON);
      }

     Tritonsys_INT2_Clear();


	
    return 0x00; 		
}


void triton_sim_detect_enable(void)
{
int previous_content;
  MSI2C_AccessPage(SIM_Card_page);
  MSI2C_MasterPollingSendAbb(TOGGLE1,0x80);
  MSI2C_MasterPollingSendAbb(SIMDEBOUNCING,simdeboundeing_time_2_ms);
previous_content = MSI2C_MasterPollingReceiveAbb(SIMDTCCTRL);
//  MSI2C_MasterPollingSendAbb(SIMDTCCTRL,0x06);
//  MSI2C_MasterPollingSendAbb(SIMDTCCTRL,0x05);
//  MSI2C_MasterPollingSendAbb(SIMDTCCTRL,0x06);
//  MSI2C_MasterPollingSendAbb(SIMDTCCTRL,0x02);
//  MSI2C_MasterPollingSendAbb(SIMDTCCTRL,0x01);

}

void triton_sim_status(void)
{
int previous_content;
  MSI2C_AccessPage(SIM_Card_page);
previous_content = MSI2C_MasterPollingReceiveAbb(PWDNSTATUS);

 

}


void triton_vib_enable(void)
{
  MSI2C_AccessPage(VIB_page);
  MSI2C_MasterPollingSendAbb(TOGGLE1,0x88);

}


void triton_test(void)
{
	unsigned short val ;
	while(val)
	{
		UART_Printf(UART2,"\n\r");
		UART_Printf(UART2,"==========================================\r\n");
    	UART_Printf(UART2,"   TRITON Test Menu\n");
    	UART_Printf(UART2,"==========================================\r\n");    	
    	UART_Printf(UART2,"0 : EXIT \r\n");
    	UART_Printf(UART2,"1 : LDO test\r\n");
    	UART_Printf(UART2,"2 : INT test\r\n");
		UART_Printf(UART2,"3 : INT clear\r\n");
 //       UART_Printf(UART2,"4 : triton shut down test\n");
		UART_Printf(UART2,"4 : I2S ports test\r\n");
		UART_Printf(UART2,"5 : AUDIO loop test\r\n");
		UART_Printf(UART2,"6 : headset test\r\n");
	    UART_Printf(UART2,"7 : Charger Test\r\n");
		UART_Printf(UART2,"8 : RTC Test \r\n");
		UART_Printf(UART2,"9 : Triton Power Test\r\n");
		UART_Printf(UART2,"10 :WLED Test\r\n");
		UART_Printf(UART2,"11 :Vibrator Test\r\n");
		UART_Printf(UART2,"12 :power script Test.VRDBB to RESET delay 10ms\r\n");
        UART_Printf(UART2,"13 :Triton_ClassD_open\r\n");
		UART_Printf(UART2,"14 :Triton_FM_AMP_test\r\n");
		UART_Printf(UART2,"16 :rxtx_radio\r\n");
		UART_Printf(UART2,"17 :triton shut down test\r\n");
    	UART_Printf(UART2,"------------------------------------------\n\r");
  		UART_Printf(UART2,"Please Enter your choice: \r\n ");   
		val = UART_GetNum(UART2);
    	UART_Printf(UART2,"\n\r");
    
        switch (val)
    	{     		
    		case 0:
    		{
    		   break;
    		}	
    		case 1:
    		{
    		triton_ldo_test();
			  	break;
    		}   
    		case 2:
    		{
//			GPIO_ItConfig(2,58);
    		Triton_int_test();
//			Tritonsys_INT2_Clear();
    		  break;
            }
            case 3:
			{
			Tritonsys_INT2_Clear();
			break;
			}
            case 4:
			{
            tritonsys_recorder_voice();
        //    
            break;}
			case 5:
			{
			tritonsys_voice_loop_back();
			break;
            }
			case 6:
			{Triton_voice_headset_test();
		//	tritonsys_recorder_voice();
			break;
            }
			case 7:
			{
			 Battery_Charge_Test();
			 break;
			}
			case 8:
			{
			RTC_TestMenu();
			break;
			}
			case 9:
			{
			Power_Test_Menu();
			break;
			}
             case 10:
			 triton_WLED_test();
			 break;
			 case 11:
			  Vibrator_Test(); 
             break;
			 case 12:
//			Triton_script_test();
             break;
			 case 13:
			Triton_ClassD_open(1);
			break;
			case 14:
			Triton_FM_AMP_test();

			break;
			case 15:
			PM_P1_P2_P3_DEVOFF();

			break;	
			case 16:
//			rxtx_radio();
			break;
			case 17:
			PM_P1_P2_P3_DEVOFF();
			break;
			case 18:
//			AVTIVE_TO_SLEEP_SW();
            (*(short*)0xFFFb1028) = (0xdfff & (*(short*)0xFFFb1028))|0x0008;
             (*(unsigned long*)0xFFFece04) = ( (~0x00000400) & (*(unsigned long*)0xFFFece04));
			break;
			default:
			break;
        }
	}

}





































⌨️ 快捷键说明

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