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

📄 l1tm_cust.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 4 页
字号:
						l1s_dsp_com.dsp_param_ptr->a_fir31_downlink[coef_no] = (table[coef_no*2+1]<<8) | table[coef_no*2];
#endif
					tm_return->status = E_OK;
				}
				else
					tm_return->status = E_BADSIZE;
			}
			break;
		case 2:// PCTM command to update UL FIR: STW 2 [coef 1] [coef 2] .. [coef 31]
			{  // First initialize PCTM by writing: STW -s 2 "%31[%y %]"
				if ( size == (31*2) )
				{
					for ( coef_no=0; coef_no<31; coef_no++ )
#if (DSP == 33)
						l1s_dsp_com.dsp_param_ptr->a_fir31_uplink[coef_no] = (table[coef_no*2+1]<<8) | table[coef_no*2];
#else
//glowing,2004-06-17,modify
//						l1s_dsp_com.dsp_ndb_ptr->a_fir31_uplink[coef_no] = (table[coef_no*2+1]<<8) | table[coef_no*2];
						l1s_dsp_com.dsp_param_ptr->a_fir31_uplink[coef_no] = (table[coef_no*2+1]<<8) | table[coef_no*2];
#endif
					tm_return->status = E_OK;
				}
				else
					tm_return->status = E_BADSIZE;
			}
			break;
		case 3:// PCTM command to update AEC/Noise Reduction algo.: STW 3 [value]
			{
				l1s_dsp_com.dsp_ndb_ptr->d_aec_ctrl = (table[1]<<8) | table[0];	   // aec/nr control variable
				l1a_l1s_com.aec_task.command.start = FALSE;		  // Start the AEC with new setting
				tm_return->status = E_OK;
			}
			break;
			//end of xmzhou add-----------------------------------------------------------
		case WRITE_REG_TEST:
			Reg=(table[0]<<24) | (table[1]<<16) |(table[2]<<8) |(table[3]);
			pReg=(UWORD16 *)Reg;
			*pReg=(table[4]<<8) |table[5];

			tm_return->size = 2;
			memcpy(tm_return->result, (UWORD8 *)&value, 2);
			tm_return->index = index;
			tm_return->status = E_OK;
			break;
		case READ_REG_TEST:
			Reg=(table[0]<<24) | (table[1]<<16) |(table[2]<<8) |(table[3]);
			pReg=(UWORD16 *)Reg;
			value=*pReg;
			tm_return->size = 2;
			memcpy(tm_return->result, (UWORD8 *)&value, 2);
			tm_return->index = index;
			tm_return->status = E_OK;
			break;


		case WRITE_IMEI://write Imei  
			nRetval=write_imei(&table[0]);
			if ( nRetval==FALSE )
			{
				tm_return->size = 0;
				tm_return->index = index;
				tm_return->status = E_NOSUBSYS;
				return;
			}
			tm_return->size = 2;
			memcpy(tm_return->result, (UWORD8 *)&value, 2);
			tm_return->index = index;
			tm_return->status = E_OK;
			break;
		case WRITE_SERIALNUMBER://write serial number
			nRetval=write_SerialNumber(&table[0]);
			if ( nRetval==FALSE )
			{
				tm_return->size = 0;
				tm_return->index = index;
				tm_return->status = E_NOSUBSYS;
				return;
			}
			tm_return->size = 2;
			memcpy(tm_return->result, (UWORD8 *)&value, 2);
			tm_return->index = index;
			tm_return->status = E_OK;
			break;
		case KEY_SIMULATION:
			nRetval=key_simulation(size,&table[0]);
			if ( nRetval==FALSE )
			{
				tm_return->size = 0;
				tm_return->index = index;
				tm_return->status = E_NOSUBSYS;
				return;
			}
			tm_return->size = 2;
			memcpy(tm_return->result, (UWORD8 *)&value, 2);
			tm_return->index = index;
			tm_return->status = E_OK;
			break;
		case SET_RTC:
			{
				T_RVF_RET ret;
				ret=RTC_SetDateTime(*((T_RTC_DATE_TIME *)table));
				if ( ret!=RV_OK )
				{
					tm_return->size = 0;
					tm_return->index = index;
					tm_return->status = E_NOSUBSYS;
					return;
				}
				tm_return->size = 2;
				memcpy(tm_return->result, (UWORD8 *)&value, 2);
				tm_return->index = index;
				tm_return->status = E_OK;
			}
			break;


		case SET_CUR_RING:	  //chenjun add 2003-01-23 to set ringtype, alarmtype and grouping ringtype
			SetRingAlarmGroupRing( table);
			tm_return->size = 18;
			tm_return->index = index;
			tm_return->status = E_OK;
			break;
		case WRITE_CMD_PW:
			tm_return->size = 2;
			memcpy(tm_return->result, (UWORD8 *)&value, 2);
			tm_return->index = index;
			if ( (strncmp((char *)table,CmdPW,6)==0) )
			{
				OpenCmd=1;
				tm_return->status = E_OK;
				return ;
			}
			else
			{
				OpenCmd=0;
				tm_return->status = E_NOSYS;
				return ;
			}
			//end of hxl add,2003-4-14
			break;
		default:
			tm_return->size = 0;
			tm_return->index = index;
			tm_return->status = E_BADCID;
			return;
	}

//glowing,2004-06-17,end of import

}

void Cust_tm_special_table_read(T_TM_RETURN *tm_return, WORD8 index)
{
#if 0
  tm_return->size = 0;
  tm_return->index = index;
  tm_return->status = E_NOSYS;
#endif  
	extern void GetRingAlarmGroupRing(char* data );//chenjun add 2003-01-23
	extern char *ver, *date;
	
	char value[30];
	int nRetval;

	switch ( index )
	{
		case READ_IMEI://read Imei  
			nRetval=get_imei(value);

			if ( nRetval==FALSE )
			{
				tm_return->size = 0;
				tm_return->index = index;
				tm_return->status = E_NOSUBSYS;
			}
			else
			{
				tm_return->size = 16;
				memcpy(tm_return->result, value, tm_return->size);
				tm_return->index = index;
				tm_return->status = E_OK;
			}

			break;
		case READ_SERIALNUMBER://read serial number
			nRetval=read_SerialNumber(value);

			if ( nRetval==FALSE )
			{
				tm_return->size = 0;
				tm_return->index = index;
				tm_return->status = E_NOSUBSYS;
			}
			else
			{
				tm_return->size = 8;
				memcpy(tm_return->result, value, tm_return->size);
				tm_return->index = index;
				tm_return->status = E_OK;
			}
			break;
		case READ_RTC:
			{
				//		nRetval=read_rtc(value);
				T_RVF_RET ret;
				T_RTC_DATE_TIME data_time;
				ret=RTC_GetDateTime(&data_time);

				if ( ret!=RV_OK )
				{
					tm_return->size = 0;
					tm_return->index = index;
					tm_return->status = E_NOSUBSYS;
					return;
				}
				else
				{
					sprintf(value,"%2d:%2d:%2d %2d-%2d-%2d %2d;%d;%d",
							data_time.hour,
							data_time.minute,
							data_time.second,
							data_time.year,
							data_time.month,
							data_time.day,
							data_time.wday,
							data_time.mode_12_hour,
							data_time.PM_flag);
					value[24]=0;

					tm_return->size = 25;
					memcpy(tm_return->result, value, tm_return->size);
					tm_return->index = index;
					tm_return->status = E_OK;
				}
			}
			break;
			//zhonghz, for read rtc control REG
		case READ_RTC_STATUS:
			{
				T_RVF_RET ret;
				T_RTC_STATUS rtc_status;
				char tmpvalue[100];
				memset(tmpvalue,0,100);
				ret=RTC_GetStatus(&rtc_status);

				if ( ret!=RV_OK )
				{
					tm_return->size = 0;
					tm_return->index = index;
					tm_return->status = E_NOSUBSYS;
					return;
				}
				else
				{
					sprintf(tmpvalue,"ctrl:0x%2x,stat:0x%2x,int:0x%2x,cl:0x%2x,cm:0x%2x",
							rtc_status.ctrl_reg,
							rtc_status.stat_reg,
							rtc_status.int_reg,
							rtc_status.cmpl_reg,
							rtc_status.cmpm_reg);
					tmpvalue[45]=0;
					tm_return->size = 44;
					memcpy(tm_return->result, tmpvalue, tm_return->size);
					tm_return->index = index;
					tm_return->status = E_OK;
				}
			}
			break;
		case CHECK_FILE_STATUS:
			{
				UWORD8  size;
				size=IsPcCmdExcuteEnd(value); 

				tm_return->size = size;
				memcpy(tm_return->result, value, tm_return->size);
				tm_return->index = index;
				tm_return->status = E_OK;

				MmiTraceInt(value[0]);
				MmiTraceInt(value[1]);
				MmiTraceInt(value[2]);
				MmiTraceInt(value[3]);
				MmiTraceInt(size);
			}
			
			g_pcsyncstatus=1;
			break;

		case  GET_CUR_RING:	  //chenjun add 2003-01-23
			GetRingAlarmGroupRing(value);
			tm_return->size =18;
			memcpy(tm_return->result, (unsigned char*)value, 18);
			tm_return->index = index;
			tm_return->status = E_OK;
			break;

		case READ_SWVER:		
			tm_return->index = index;
			tm_return->status = E_OK;
			tm_return->size = strlen(ver)+strlen(date);			
			memcpy((void*)tm_return->result, (void*)ver, strlen(ver));
			memcpy((void*)(tm_return->result + strlen(ver)), (void*)date, strlen(date));
			return;		

		default:
			tm_return->size = 0;
			tm_return->index = index;
			tm_return->status = E_BADCID;
			break;
	}

}

void Cust_tm_special_enable(T_TM_RETURN *tm_return, WORD16 action)
{
#if 0
  tm_return->size = 0;
  tm_return->index = action;
  tm_return->status = E_NOSYS;
#endif
	//Bob added 03/21
	int i=0,j=0;
	//char name[8];
	char *ptr;
	tm_return->size = 0;
	tm_return->index = action;
	tm_return->status = E_NOSYS;

	//by xmzhou to enable DAI test according to Jesper
	if ( action == 1 ) // PCTM command to activate MCSI: SE 1
	{
		*((volatile UINT16 *) 0xfffef00a) &= 0xfe1f; // Switch GPIO to MCSI (DAI) mode
		tm_return->status = E_OK;
	}
	//by xmzhou to enable LCD backlight
	if ( action == 2 )
	{
		ctrlcd(255); //open LCD backlight
		tm_return->status = E_OK;
	}

	//by xmzhou to disable LCD backlight
	if ( action == 3 )
	{
		ctrlcd(0); //disable LCD backlight
		tm_return->status = E_OK;
	}

	//by xmhout to test l1 engineering mode rx level and quality
	if ( action == 4 )
	{
		extern void layer1_em_get_rxlevqual(WORD32 *l1_rxlev_scell,WORD32 *l1_rxlev_dedic_sub,
											WORD32 *l1_rxqual_dedic,WORD32 *l1_rxqual_dedic_sub);

		WORD32 a,b,c,d;

		layer1_em_get_rxlevqual(&a,&b,&c,&d);
		tm_return->status = E_OK;
	}

	//by xmzhou to test l1 engineering mode l1_mode
	if ( action == 5 )
	{
		extern void layer1_em_get_mode(WORD32 *l1_mode);

		WORD32 a;

		layer1_em_get_mode(&a);
		tm_return->status = E_OK;
	}

	//by xmzhou to play melody E2 No1
	if ( action == 6 )
	{
		//	extern void RingStart1(void);

		// 	RingStart1();
		tm_return->status = E_OK;
	}
	//by xmzhou to stop melody E2 No1
	if ( action == 7 )
	{
		//xtern void RingStop1(void);

		//ingStop1();
		tm_return->status = E_OK;
	}
	//by xmzhou to play melody E2 No2
	if ( action == 8 )
	{
		//extern void RingStart2(void);

		//RingStart2();
		tm_return->status = E_OK;
	}
	//by xmzhou to stop melody E2 No2
	if ( action == 9 )
	{
//	extern void RingStop2(void);

//	RingStop2();
		tm_return->status = E_OK;
	}
	if ( action==10 )
	{
		extern void ColorLCDCommandRead(void);
		ColorLCDCommandRead();
		tm_return->status = E_OK;
	}

	/*control trace comand */
	if ( action==11 )
	{
#if 0 //glowing,2004-06-17,comment	
		extern UNSIGNED RivieraTraceFlag;
		RivieraTraceFlag=1;
#endif		
		tm_return->status = E_OK;
	}
	/*control trace comand */
	if ( action==12 )
	{
#if 0 //glowing,2004-06-17,comment	
		extern UNSIGNED RivieraTraceFlag;
		RivieraTraceFlag=0;
#endif		
		tm_return->status = E_OK;

	}
	if ( action == 20 )
	{
		// 	   extern void Mic_on();
		Mic_on();        
		tm_return->status = E_OK;
	}
	if ( action == 21 )
	{
		//	   extern void Mic_off();
		Mic_off();
		tm_return->status = E_OK;
	}
	if ( action == 22 )
	{
		Spk_on();
		tm_return->status = E_OK;
	}
	if ( action == 23 )
	{
		Spk_off();
		tm_return->status = E_OK;
	}
	if ( action == 24 )
	{
		Red_On();
		tm_return->status = E_OK;
	}
	if ( action == 25 )
	{
		Red_Off();
		tm_return->status = E_OK;
	}
	if ( action == 26 )
	{
		Green_On();
		tm_return->status = E_OK;
	}
	if ( action == 27 )
	{
		Green_Off();
		tm_return->status = E_OK;
	}
	if ( action == 28 )
	{
		Vibrator_on();
		tm_return->status = E_OK;
	}

	if ( action == 29 )
	{
		Vibrator_off();
		tm_return->status = E_OK;
	}
	if ( action == 30 )
	{
		Backlight_ON();
		tm_return->status = E_OK;
	}
	if ( action == 31 )
	{
		Backlight_OFF();
		tm_return->status = E_OK;
	}
	//end Bob added 01/25
	if ( action == 32 )
	{
		SetMVol_DownLinkPGA(6); 
		//StartMelody(0);
		StartPlayingMelody2(0,0); //glowing,2003-12-23, use the yamaha api
		tm_return->status = E_OK;
	}
	if ( action == 33 )
	{
		//StopMelody();
		StopPlayingMelody2(); //glowing,2003-12-23, use the yamaha api
		tm_return->status = E_OK;
	}
	if ( action==34 )	//ganchh 2003/3/15 for Layer1 and Riviera trace switch on
	{
#if 0 //glowing,2004-06-17,comment	
		extern UWORD32 layer1_trace_mask;
		extern UWORD32 riviera_trace_mask;
		layer1_trace_mask=0xffffffff;//enable all the layer1 trace
		riviera_trace_mask=0xffffffff;//enable all trace
#endif		
		tm_return->status = E_OK;
	}
	if ( action==35 )
	{
#if 0	//glowing,2004-06-17,comment
		extern UWORD32 layer1_trace_mask;
		extern UWORD32 riviera_trace_mask;
		layer1_trace_mask=0x0; //disable all the layer1 trace
		riviera_trace_mask=0x0;	//diable all trace
#endif		
		tm_return->status = E_OK;
	}
	if ( action == 50 )
	{
		GetTimerInfo();
		tm_return->status = E_OK;
	}
	if ( action == 51 )
	{
		GetTaskInfo();
		tm_return->status = E_OK;
	}
	if ( action ==52 )
	{
		// TestTimerInfo();
		tm_return->status = E_OK;
	}
#if 0	
	if ( action == 53 )
	{
		timer =  TMD_Active_Timers_List;
		MmiTrace("T is:");
		while ( i<8 )
		{
			app_timer =  (TM_APP_TCB *) timer -> tm_information;
			expiration_routine =  app_timer -> tm_expiration_routine;
			ptr=(((TM_APP_TCB *)app_timer)->tm_name);
			for ( j=0;j<8;j++ )
				Bobname[i][j]=*ptr++;  //app_timer->tm_name[j];pointer =  (((TC_TCB *) TCD_Current_Thread) -> tc_name);
			//  MmiTrace(name);
			MmiTraceInt(expiration_routine);
			timer=(TM_TCB *)timer->tm_next_timer;
			i++;
			//     Bobtrace(name, ((TM_APP_TCB *)app_timer -> tm_expiration_routine));
		}
		tm_return->status = E_OK;
	}
	if ( action == 55 )
	{

		for ( i=0;i<8;i++ )
			MmiTrace(Bobname[i]);
		tm_return->status = E_OK;
	}
#endif	

}

void Cust_set_voicefir(void){
#if 0	
	int i;
	extern T_L1S_DSP_COM l1s_dsp_com; // Get access to DSP configuration
	for ( i=0; i<31; i++ )
	{
		l1s_dsp_com.dsp_param_ptr->a_fir31_downlink[i] =voice_a_fir31_downlink[i];
	}
#endif	
}


#endif // TESTMODE

⌨️ 快捷键说明

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