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

📄 rtc_test_misc.c

📁 MMI层OBJ不能完全编译
💻 C
📖 第 1 页 / 共 4 页
字号:
}



/********************************************************************************/
/*                                                                              */
/*      Function Name:   rtc_test_misc_1                                        */
/*                                                                              */
/*      Notes:         This function executes RTC misc tests.                   */
/*                                                                              */
/*      Revision History:                                                       */
/*      03/20/01      Laurent Sollier         Create.                           */
/*      06/25/03      Thierry VEDEL           Modifie                           */
/*                                                                              */
/*      result : TEST_PASSED, TEST_FAILED or TEST_IRRECOVERABLY_FAILED			*/
/********************************************************************************/

void rtc_test_misc_1 (void)
{
   T_RV_MISC_ERR_TYPE   error_type         = NO_ERR;
   UINT16 received_event;
   T_RV_HDR   *msg_p;

   UINT8 time[15];
   UINT8 date[15];
   UINT8 gauging_started = 0;
   T_RTC_DATE_TIME date_time;

   T_KPD_SUBSCRIBER subscriber_id;
   T_KPD_VIRTUAL_KEY_TABLE notified_keys;
   T_RV_RETURN kpd_return_path;
	T_RVF_RET ResultFunction;
	UINT8 ui_First=TRUE;
	UINT8	uc_id_obtained=1;//tve
	UINT8	uc_id_waited=1; //tve
	BOOL		b_resultMsg=FALSE; //tve


	/*********************** Start rtc_test_misc function ***********************/

	s_resultInfo.display_format=DIS_BYTE; //tve
	s_resultInfo.display_base=DIS_DEC;//tve		
   
   LCD_Init();
   rvf_dump_mem();
   rvf_dump_tasks();
	uc_Exit=FALSE;		/* Init exit */
	

   /* Keypad registration */
   kpd_return_path.callback_func = key_event;
   notified_keys.nb_notified_keys = KPD_NB_PHYSICAL_KEYS;
   kpd_subscribe (&subscriber_id,
                  KPD_DEFAULT_MODE,
                  &notified_keys,
                  kpd_return_path);

   /* Activate timer for display time */
   rvf_start_timer(RVF_TIMER_0, RVF_MS_TO_TICKS(1000), TRUE);

   /* Activate timer for test process */
   rvf_start_timer(RVF_TIMER_1, RVF_MS_TO_TICKS(3000), TRUE);

#ifndef _WINDOWS
   #if (CHIPSET == 12)
     F_INTH_ENABLE_ONE_IT(C_INTH_ULPD_GAUGING_IT);
   #elif (CHIPSET == 15)
   #else
	/* Enable IRQ11 */
     IQ_Unmask(IQ_ULPD_GAUGING);
   #endif
   /* Set gauging configuration */
   ULDP_GAUGING_SET_HF;
   ULDP_GAUGING_HF_PLL;
#endif

	uc_id_waited = RV_OK;		  
	sprintf((char*)s_resultInfo.test_ref,"%s",RTC_001_REF);
	sprintf((char*)s_resultInfo.test_name,"%s",RTC_001_NAME);
	sprintf((char*)s_resultInfo.test_comment,"%s",RTC_001_COMMENT);
	gen_display_header (&s_resultInfo);
	
   /* Test a RTC reset */
	if (!RTC_RtcReset()) 
	{
		LCD_WriteString( 2, 0, "Reset FAILED", NORMAL);

		uc_id_obtained = RV_INTERNAL_ERR;
		b_resultMsg = gen_display_table_result(&uc_id_waited, &uc_id_obtained, sizeof(uc_id_waited),&s_resultInfo);
		gen_display_report (b_resultMsg);
	
		rtest_send_result(TEST_FAILED);
		return;
	}
	else
	{
		LCD_WriteString( 2, 0, "Reset PASSED", NORMAL);
		uc_id_obtained = RV_OK;
		b_resultMsg = gen_display_table_result(&uc_id_waited, &uc_id_obtained, sizeof(uc_id_waited),&s_resultInfo);
		gen_display_report (b_resultMsg);

   /* loop to process messages */
   while (1)
   {
			
			if(uc_Exit==TRUE)
				break;
			
      /* Wait for the necessary events (infinite wait for a msg in the mailbox 0). */
      received_event = rvf_wait ( 0xffff,0);

      if (received_event & RVF_TASK_MBOX_0_EVT_MASK)
      {
         /* Read the message */
         msg_p = (T_RV_HDR *) rvf_read_mbox(0);

         rvf_free_buf(msg_p);
      }

      if (received_event & RVF_TIMER_0_EVT_MASK)
      {
         /* Timer for display time */
				ResultFunction=RTC_GetDateTime(&date_time);
				if (ResultFunction == RVF_NOT_READY)
         {
					LCD_WriteString( 2, 0, "GetDateTime WAIT", NORMAL);
            rvf_delay(RVF_MS_TO_TICKS(1));
					ResultFunction=RTC_GetDateTime(&date_time);
					if(ResultFunction==RVF_OK)
						if(ui_First==TRUE)
						{
							LCD_WriteString( 2, 0, "GetDateTime PASSED", NORMAL);
							ui_First=FALSE;
						}
         }
				else
					if(ResultFunction==RVF_INTERNAL_ERR)
					{
						LCD_WriteString( 2, 0, "GetDateTime FAILED", NORMAL);
						rtc_test_verdict=TEST_FAILED;
						break;
					}
					else
						if(ui_First==TRUE)
						{
							LCD_WriteString( 2, 0, "GetDateTime PASSED", NORMAL);
							ui_First=FALSE;
						}
						

         if (date_time.mode_12_hour == FALSE)
         {
            sprintf((char*)time, "%02d:%02d:%02d      ",
                    date_time.hour, date_time.minute, date_time.second);
         }
         else
         {
            if (date_time.PM_flag == TRUE)
               sprintf((char*)time, "%02d:%02d:%02d PM   ",
                       date_time.hour, date_time.minute, date_time.second);
            else
               sprintf((char*)time, "%02d:%02d:%02d AM   ",
                       date_time.hour, date_time.minute, date_time.second);
         }
         sprintf((char*)date, "%02d/%02d/%02d",
                 date_time.month, date_time.day, date_time.year);

         LCD_WriteString( 0, 0, (char*) date, NORMAL);
         LCD_WriteString( 1, 0, (char*) time, NORMAL);
      }

      if (received_event & RVF_TIMER_1_EVT_MASK)
      {
         /* Timer for test execution */
         execute_test();
				if(rtc_test_verdict==TEST_FAILED)
					break;
				
         rvf_dump_mem();
         rvf_dump_tasks();
      }

      if (received_event & RVF_TIMER_2_EVT_MASK)
      {
#ifndef _WINDOWS
         if (!gauging_started)
         {
            /* Start gauging */
            ULDP_GAUGING_START;
            rvf_start_timer(RVF_TIMER_2, RVF_MS_TO_TICKS(50), FALSE);
            gauging_started = 1;
         }
         else
         {
            /* Sop gauging */
            ULDP_GAUGING_STOP;
            rvf_start_timer(RVF_TIMER_2, RVF_MS_TO_TICKS(10000), FALSE);
            gauging_started = 0;
         }
#endif
      }
   }
  }
  rtest_send_result(rtc_test_verdict);
}

/********************************************************************************/
/*                                                                              */
/*      Function Name:   key_event		                                        */
/*                                                                              */
/*      Notes:         This function executes RTC tests.		<html>		    */
/*      Revision History:                                                       */
/*      03/20/01      Laurent Sollier         Create.                           */
/*      06/26/03      Thierry VEDEL           Modifie.                          */
/*                                                                              */
/********************************************************************************/
void key_event(void* msg_p)
{
	T_RTC_DATE_TIME date_time;
	T_KPD_KEY_EVENT_MSG* keypad_evt;
	T_RV_HDR* evt = (T_RV_HDR*) msg_p;
	
	
	if ( (evt->msg_id == KPD_KEY_EVENT_MSG)
		&& (((T_KPD_KEY_EVENT_MSG*) evt)->key_info.state == KPD_KEY_RELEASED) )
	{
		keypad_evt = (T_KPD_KEY_EVENT_MSG*) evt;
		switch(keypad_evt->key_info.virtual_key_id)
		{
			
		case KPD_KEY_DISCONNECT:
			uc_Exit=TRUE;
			break;
			
		case KPD_KEY_1:
			/* add one hour when '1' pressed */
			if (RTC_GetDateTime(&date_time) == RVF_NOT_READY)
			{
				rvf_delay(RVF_MS_TO_TICKS(1));
				RTC_GetDateTime(&date_time);
			}
			date_time.hour++;
			if ( (date_time.mode_12_hour == TRUE) && (date_time.hour > 12) )
			{
				date_time.hour-=12;
				date_time.PM_flag = date_time.PM_flag ? FALSE : TRUE;
			}
			else if (date_time.hour > 23 )
				date_time.hour -= 24;
   
			if (RTC_SetDateTime(date_time) == RVF_NOT_READY)
			{
				rvf_delay(RVF_MS_TO_TICKS(1));
				RTC_SetDateTime(date_time);
			}
			break;
			
		case KPD_KEY_2:
			/* add one minute when '2' pressed */
			if (RTC_GetDateTime(&date_time) == RVF_NOT_READY)
			{
				rvf_delay(RVF_MS_TO_TICKS(1));
				RTC_GetDateTime(&date_time);
			}
			date_time.minute++;
			if (date_time.minute > 59 )
				date_time.minute -= 60;
			
			if (RTC_SetDateTime(date_time) == RVF_NOT_READY)
			{
				rvf_delay(RVF_MS_TO_TICKS(1));
				RTC_SetDateTime(date_time);
			}
			break;

		case KPD_KEY_3:
			/* add one second when '3' pressed */
			if (RTC_GetDateTime(&date_time) == RVF_NOT_READY)
			{
				rvf_delay(RVF_MS_TO_TICKS(1));
				RTC_GetDateTime(&date_time);
			}
			date_time.second++;
			if (date_time.second > 59 )
				date_time.second -= 60;
			
			if (RTC_SetDateTime(date_time) == RVF_NOT_READY)
			{
				rvf_delay(RVF_MS_TO_TICKS(1));
				RTC_SetDateTime(date_time);
			}
			break;
			
		case KPD_KEY_4:
			/* 12 hours mode */
			if (RTC_Is12HourMode() == FALSE)   
				RTC_Set12HourMode(TRUE);
			else
				RTC_Set12HourMode(FALSE);
			break;
			
		case KPD_KEY_5:
			/* Rounding 30 sec */
            RTC_Rounding30s();
			break;
			
		}
	}
}


/********************************************************************************/
/*                                                                              */
/*      Function Name:   rtc_test_misc		                                    */
/*                                                                              */
/*      Notes:         This function executes RTC misc tests.                   */
/*                                                                              */
/*      Revision History:                                                       */
/*      06/25/03      Thierry VEDEL           Create                            */
/*                                                                              */
/* @param	test_number		Number of the test to process						*/
/* @return	Result of the test.													*/
/********************************************************************************/
T_RV_MISC_RET rtc_test_misc (T_RV_MISC_TEST_NBR test_number)
{
	T_RV_TEST_RET test_verdict;

	switch (test_number)
	{
	case 1:
		RV_TEST_TRACE_HIGH("*** RTC MISC 1 BEGINS");
		
		test_verdict = rtest_start_test(rtc_test_misc_1);
		rtest_trace_test_verdict(test_verdict);

		return test_verdict;

	default:
		RV_TEST_TRACE_ERROR("RTC Test: Wrong test number");

		return TEST_IRRECOVERABLY_FAILED;
	}
}

/************************ Stop l2cap_test_certif function ***********************/

#endif /* #if (RTC_MISC == SW_COMPILED) */

⌨️ 快捷键说明

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