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

📄 dp_call.c

📁 话带数据中传真解调程序
💻 C
📖 第 1 页 / 共 2 页
字号:
   dp_ringback_off_cadence = 0;   dp_ringback_cycles = 0;}// ?bool dp_ringback_detected (void){   int eax;   bool state_changed = false;   int ecx = dp_ringback_state;   int edx = 0;   eax = dp_read_dsp_ram(0x3A) & 0x1000;   if (eax == 0) edx = 1;   if (dp_ringback_state == 1) goto loc_2AF1D;   if (dp_ringback_state != 2) goto loc_2AF68;   // Ringback state is 2.    if (eax == 0) goto loc_2AF68;   eax = x_elapsed_time(dp_ringback_off_timer);   dp_ringback_off_cadence = eax;   if (eax <= 0x1f4) goto loc_2AF0F;   dp_ringback_on_timer = x_current_time();loc_2AF0F:   dp_ringback_state = 1;   state_changed = true;   goto loc_2AF5D;//----------------------------------   // Ringback state is 1. loc_2AF1D:   if (edx == 0) goto loc_2AF4B;   dp_ringback_on_cadence = x_elapsed_time(dp_ringback_on_timer);   dp_ringback_state = 2;   state_changed = true;   // Reset on timer.   dp_ringback_on_timer = x_current_time();loc_2AF4B:   eax = x_elapsed_time(dp_ringback_on_timer);   if (eax <= 0xc8) goto loc_2AF68;loc_2AF5D:   // Reset off timer.   dp_ringback_off_timer = x_current_time();loc_2AF68:   // Has there been a transition in the ringback state   // and are the cadence values in range.   if ((state_changed == true)      && (dp_ringback_on_cadence > 800)      && (dp_ringback_on_cadence <= 3000)      && (dp_ringback_off_cadence > 1000))	 // If so we have completed another cycle.	 dp_ringback_cycles++;   if (dp_ringback_cycles > 0) {	 eax = x_elapsed_time(dp_ringback_off_timer);	 ecx = (S(0x45) * 100) + 150;	 if (eax > ecx) return true;	 if (dp_ringback_cycles != 0) return false;   }   eax = x_elapsed_time(dp_no_ringback_timer);   ecx = S(0x46) * 1000;   if (eax <= ecx) 	 return false;   else	 return true;}bool dp_quiet_answer_detected(void){  int q_time;  if(dp_read_dsp_ram(0x27) != 0) {	dp_quiet_answer_timer = x_current_time();	return false;  }  q_time = x_elapsed_time(dp_quiet_answer_timer);   if (q_time > 0x1387)	return true;  else	return false;}void dp_calling_tone_cmd (void){   short dsp_value;   if ((S(0x55) == 6) || (S(0x74) == 0) || (S(0x74) == 1)) goto loc_2B08E;   if ((ETC_mode & 3) != 1) goto loc_2B04E;   dp_write_dsp_ram(5, 0x3DD1);   dsp_value = 0x1090;   goto loc_2B05F;loc_2B04E:   dp_write_dsp_ram (5, 0x3A00);   dsp_value = 0x1B0C; loc_2B05F:   dp_write_dsp_ram(6, dsp_value);   dp_write_dsp_ram(0x17, 0x262);   dp_write_dsp_ram(0x11, H_transmit_level_ndB);   dp_modem_command(7, 1, 0);   return; loc_2B08E:   if (S(0x38) == 10) return;   // The following is not in Jamie's newdis1.#if 1   if (S(0x38) != 8) goto loc_2B0B1;   if (S(0x38) != 1) goto loc_2B0B1;   if (S(0x23) >= 3) return;   S(0x23) = S(0x23) + 1;#endifloc_2B0B1:   v8_ci_orig();}void dp_detect_over_current (unsigned char arg1){  printf("dp_detect_over_current(%d): warning not yet implemented!\n", arg1);}/*   30994:	80 3d 64 2e 06 00 00 	cmpb   $0x0,H_overcurrent_sense_validation_time   3099b:	74 5f          	je     0x309fc <_dp_detect_over_current@4+0x68>   3099d:	6a 41          	pushl  $0x41   3099f:	e8 c0 31 00 00 	call   _x_input@4   309a4:	84 c0          	testb  %al,%al   309a6:	74 49          	je     0x309f1 <_dp_detect_over_current@4+0x5d>   309a8:	66 a1 80 29 06 00 	movw   _dp_ocp_timer,%ax   309ae:	50             	pushl  %eax   309af:	e8 5a 68 00 00 	call   _x_elapsed_time@4   309b4:	0f b7 c8       	movzwl %ax,%ecx   309b7:	0f b6 05 64 2e 06 00 	movzbl H_overcurrent_sense_validation_time,%eax   309be:	8d 04 80       	leal   (%eax,%eax,4),%eax   309c1:	d1 e0          	shll   %eax   309c3:	3b c8          	cmpl   %eax,%ecx   309c5:	7c 35          	jl     0x309fc <_dp_detect_over_current@4+0x68>   309c7:	8a 44 24 04    	movb   0x4(%esp,1),%al   309cb:	6a 03          	pushl  $0x3   309cd:	f6 d8          	negb   %al   309cf:	1b c0          	sbbl   %eax,%eax   309d1:	c7 05 88 2d 06 00 21 00 00 00 	movl   $0x21,_dp_state   309db:	83 e0 07       	andl   $0x7,%eax   309de:	40             	incl   %eax   309df:	40             	incl   %eax   309e0:	a3 08 2f 06 00 	movl   %eax,_x_dial_residual   309e5:	e8 12 32 00 00 	call   _x_output@4   309ea:	e8 63 aa ff ff 	call   _dp_over_current_alert@0   309ef:	eb 0b          	jmp    0x309fc <_dp_detect_over_current@4+0x68>   309f1:	e8 e4 67 00 00 	call   _x_current_time@0   309f6:	66 a3 80 29 06 00 	movw   %ax,_dp_ocp_timer   309fc:	c2 04 00       	ret    $0x4   309ff:	cc             	int3   */// I think this is used to maintain a list of failed call numbers.void dp_update_blacklist (char* szDialstring, unsigned char arg2){  printf("dp_update_blacklist(%p, %d): warning not yet implemented!\n", szDialstring, arg2);}void dp_dial (void){  /* Needs sorting out!  int eax, ebx, edi;  void* esi;  unsigned char cl;  // Make room on the stack.		 sub	 esp, 54h  eax = dp_dial_state;  if (eax > 0xa) goto loc_2B6E7; // 9922    switch(eax) {  case 0: goto loc_2B341;  case 1: goto loc_2B51F;  case 2: goto loc_2B577;  case 3: goto loc_2B6AA;  case 4: goto loc_2B713;  case 5: goto loc_2B757;  case 6: goto loc_2B7AA;  case 7: goto loc_2B800;  case 8: goto loc_2B857;  case 9: goto loc_2BD3C;  case 0xA: goto loc_2BD9D; loc_2B341:  ebx = 0;  dp_busy_cycles = 0;  dp_answer_state = 0;  dp_max_pause = 0;  dp_continous_busy_timer = x_current_time();  esi = dp_dial_string;  if (dp_stored_number(dp_dial_string) == 0){	x_dial_residual = 0;	goto loc_2B850;  }  dp_dial_ptr = dp_dial_string;  edi = 1;  // byte_59F16 = H_dial_modifier_validation  if (H_dial_modifier_validation != 1) goto loc_2B3D2;  if (dp_test_dialstring(esi) == 0)	*dp_dial_string = 0;  eax = esi; //dp_dial_stringloc_2B3A0:  dp_dial_ptr = eax;  cl = *eax;  if((cl == 0x54) || (cl == 0x50)) goto loc_2B3B6;  if(cl != 0x2c) goto loc_2B3C7;loc_2B3B6:  if (*(eax + 1) != 0x2c) goto loc_2B3C7;  *(eax + 1) = cl;  eax = dp_dial_ptr;  eax++;  goto loc_2B3A0;loc_2B3C7:  if (*eax != 0x2c) goto loc_2B3D2;  eax++;  dp_dial_ptr = eax;loc_2B3D2:  if (*eax != 0x54) goto loc_2B3DE;  byte_59E8F = 1;loc_2B3DE:  if (*eax != 0x50) goto loc_2B3F3;  if(byte_59F20 != 0) goto loc_2B3F3;  byte_59E8F = 0;loc_2B3F3:   //ebx = 0?  if (dp_dialing_status != ebx) goto loc_2B45D;  eax = x_modem_mode;  if (eax == ebx) goto loc_2B408;  if (eax != edi) goto loc_2B45D;loc_2B408:  if (byte_59EDA != 0) goto loc_2B428;  if (byte_59EFE == 0) goto loc_2B428;  if (dp_check_list(esi) != 0) goto loc_2B850;loc_2B428:  eax = byte_59EE6;  esi = 0x1388;    //????  if (eax != 5) goto loc_2B43B;  esi = 0x1770;loc_2B43B:  if (eax == 0x19) goto loc_2B45D;  if (dp_first_call != 0) goto loc_2B45D;  eax = dp_timer1;  eax = x_elapsed_time(eax);  if (eax < esi) goto loc_2B6E7;loc_2B45D:  dp_dial_timer = x_current_time();  if (cell_originate == 1) goto loc_2B4B7;  eax = dp_dialing_status;  if (eax != ebx) goto loc_2B4A4;  eax = dp_offhook_cmd();  if (eax == 0) goto loc_2B846;  dp_dialing_status = 2;  dp_ocp_timer = x_current_time();  dp_dial_state = edi;  goto loc_2B500;loc_2B4A4:  if (eax != edi) goto loc_2B4C3;  dp_offhook_cmd();  dp_dialing_status = 2;loc_2B4B7:  dp_dial_state = 8; // DIAL_DIGIT  goto loc_2B500;loc_2B4C3:  if (_S[0x6a] != 2) goto loc_2B4D1;  dp_offhook_cmd();loc_2B4D1:  esi = 8;  if (x_modem_mode == 2) goto loc_2B4FA;  if (byte_59E97 == 0) goto  loc_2B4EC;  x_output(esi);loc_2B4EC:  x_output(0x0e);  x_output(0x13);loc_2B4FA:  dp_dial_state = esi;loc_2B500:  eax = x_current_time();  dp_dial_timer = eax;  if (byte_59E97 != 3) goto loc_2B6E7;  x_output(7);  goto loc_2B6E7;  //----------------------------------loc_2B51F:  eax = dp_dial_timer;  eax = x_elapsed_time(eax);  if (eax < 0x37) goto loc_2B66A;  eax = dp_dial_ptr;  eax = *eax  if (al == 0) goto loc_2B563;  if (al == 0x3b) goto loc_2B56B;  dp_detect_tones_cmd();  dp_dial_state = 2;  // DIAL_1  eax = x_current_time();  dp_dial_timer = eax;  goto loc_2B66A;loc_2B563:  if (eax != 0x3b) goto loc_2B60B;loc_2B56B:  dp_dialing_status = 0;  goto loc_2B60B;loc_2B577:  if (byte_59E8D != 0) || (byte_59F06 == 0) goto loc_2B5E3;  eax = dp_dial_timer;  eax = x_elapsed_time(eax);  ecx = byte_59E66;  ecx = ecx * 0x3E8; // Upper 32 bits of result in edx?    if (eax <= ecx) goto loc_2B66A;  esi = 8;  if (byte_59F06 != 2) goto loc_2B5CD;  eax = x_modem_mode;  if (eax == 0) goto loc_2B5C7;  if (eax != 1) goto loc_2B5CD;loc_2B5C7:   x_output(esi);loc_2B5CD:  eax = x_current_time();  dp_timer = eax;  dp_dial_state = esi;  goto loc_2B66A;  // Entries in jump table.loc_2B66A:loc_2B846:loc_2B850:loc_2BD9D:loc_2BD3C:loc_2B857:loc_2B800:loc_2B7AA:loc_2B757:loc_2B713:loc_2B6AA:  // Bye bye!loc_2B6E7:  eax = 0;  //0002BD93		 call	 sub__x_output_4  //0002BD98		 jmp	 loc_2B6E7  */}// Bodge routine to set up modem state for dialling.// Extracted from dp_periodic_task, called when (S + 0x72) != 0xA// and dp_state = 1;void bodge_init_dial (void){  if (dp_state == 1) {	//printf ("Setting up dial stuff.\n");	dp_state = 2;	dp_dialing_status = 0;	S_ring_count = 0;	dp_ring_int = 0;	dp_count = 0;	dp_ring_int_count = 0;	dp_calling_tone_disable = 0;	dp_timer1 = x_current_time();	dp_threshold = H_dial_tone_detection_threshold_dB;	dp_enable_ring_int();  }  // This bit is extracted from dp_dial.  dp_busy_cycles = 0;  dp_answer_state = 0;  dp_max_pause = 0;  dp_continous_busy_timer = x_current_time();}// Seems to be called when dp_state is 4, and dp_dial returns 2.// Extracted from dp_periodic_task.void bodge_after_dial_init (void){   //loc_27E92:	XREF: sub__dp_periodic_task_0+40   dp_timer = x_current_time();   dp_ocp_timer= x_current_time();   dp_threshold = H_call_progress_detection_threshold_ndB;   dp_state = 16;   x_set_current_time(&dp_long_timer);   if (S_speaker_enable == 3) x_output(8);}// Detects an incoming call.bool call_detected(void){	 if (dp_ring_detected() == true) {	   printf("Ring detected!\n");	   // Reset timer and set up modem state.	   dp_timer = x_current_time();	   dp_state = 17;	   x_modem_state = 2;	   return true;	 }	 else	   return false;}// This function is my invention, but includes code from dp_periodic_task// to set up the connection for data transfer.void connect_to_modem(void){  // What's S_connect_completion_timeout set to?  // Keep an eye on dp_long_timer  printf("Attempting to connect to remote modem...\n");  // Extracted from code for dp_state == 10.  //loc_2813D:  x_status[0x3d] = 7;           // byte_4AA5D  dp_state = 13;  if (dp_vpcm_init())	dp_state = 65;              // 535 sets dp_state = 66.  /*00028157                 mov     dword__dp_state, 42h Set above.000290C3                 cmp     dword__dp_state, 42h -> dp_vpcm_retrain_cmd in dp_task00029237                 cmp     dword__dp_state, 42h -> dp_vpcm_retrain_cmd in dp_task00029275                 cmp     dword__dp_state, 42h -> dp_vpcm_retrain_cmd in dp_task  */  else	dp_originate_cmd();  //loc_28168  if (H_blacklist_or_delay_flag)	dp_update_blacklist(dp_dial_string, 0);  dp_detect_over_current(1);  // Reset long timer.  x_minute_count = 0;  x_minute_timer = x_current_time();  x_set_current_time(&dp_long_timer);  // Main loop, try to get connected transitioning through the relevant states.    while(dp_state != 1){	//Artificial delay.	x_sleep(10);		dp_periodic_task();  }}

⌨️ 快捷键说明

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