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

📄 dt_rspfmttr.c

📁 最新MTK手机软件源码
💻 C
📖 第 1 页 / 共 3 页
字号:

      fmt++;
    }

      /* finish string with \0 */
      *buff_ptr = *fmt;
/*
    SME_FN_EXIT_LOG(
                    MOD_ATCI,
                     ATCI_FUNC_ATCIFASTSTRINGPRINT_EXIT_SUBOP
                   );
*/
      return buffer_length;
}



/*****************************************************************************
* FUNCTION
*  dt_result_code_fmttr
*
* DESCRIPTION
*  Spec 07.07 Sec 9.2
* PARAMETERS
*  kal_uint8	rsp_type :  rmmi_rsp_type_enum
*  kal_uint16  cause : rmmi_err_id_enum
* RETURNS
*  none.
* GLOBALS AFFECTED
*  none.
*****************************************************************************/
void dt_result_code_fmttr(kal_uint8 rsp_type, kal_uint16 cause)
{
   kal_uint8 buffer[DT_MAX_UART_LENGTH];
   kal_uint16 string_length = 0;
//   kal_uint8 cid;

	kal_trace(TRACE_FUNC, FUNC_DT_RESULT_CODE_FMTTR_ENTRY);

	if(DT_PTR->transfered_port == 0xff)
	{
		kal_trace(TRACE_ERROR, ERROR_DT_UART_OWNER_IS_NOT_DT);
		return;
	}
	
   	if (rsp_type != DT_RCODE_ERROR)
   		kal_trace(TRACE_GROUP_3, DT_RESULT_CODE_FMTTR, rsp_type);
   	else
		kal_trace(TRACE_GROUP_3, DT_RESULT_CODE_ERROR, rsp_type, cause);

#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
   switch (rsp_type)
   {
      case DT_RCODE_OK:


         //if (DT_PTR->rsp_mode.format == DT_NUM_PARTIAL_HEAD_TAIL)
         //{
         //   DT_PTR->arg_list[0] = (void *)&rsp_type;
         //   string_length = dt_fast_string_print (
         //                           buffer,
         //                           (kal_uint8 *)"%d",
         //                           DT_PTR->arg_list,
         //                           1
         //                          );
         //}
         //else
         //{
            string_length = dt_fast_string_print (
                                    buffer,
                                    (kal_uint8 *)"OK",
                                    DT_PTR->arg_list,
                                    0
                                   );
         //}
         break;

      case DT_RCODE_ERROR:

         //if (DT_PTR->error_report_mode == DT_SIMPLE_ERROR)
         //{
         //   if (DT_PTR->rsp_mode.format == DT_NUM_PARTIAL_HEAD_TAIL)
         //   {
         //      DT_PTR->arg_list[0] = (void *)&rsp_type;
         //      string_length = dt_fast_string_print (
         //                           buffer,
         //                           (kal_uint8 *)"%d",
         //                           DT_PTR->arg_list,
         //                           1
         //                          );
         //   }
         //   else
         //   {
               string_length = dt_fast_string_print (
                                    buffer,
                                    (kal_uint8 *)"ERROR",
                                    DT_PTR->arg_list,
                                    0
                                   );
          //  }
          //}
#if 0         
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
//	  if (cid < RMMI_MAX_CHANNEL_NUMBER)
//	  {
#ifdef UART_ENABLE
//   		kal_uint8 port;
//	        port = rmmi_cid_2_port(cid);
         DT_UART_ClrRxBuffer (DT_PTR->transfered_port, MOD_DT);
#endif
         	DT_PTR->uart_input_queue.head = 0;
         	DT_PTR->uart_input_queue.length = 0;
//	  }
         break;

      default:
         break;

   }

#if 0
#ifdef __SATC3__ // mtk00714 : __SATC3__
/* under construction !*/
#endif/* __SATC3__ */
#endif
   dt_write_to_uart((kal_uint8 *)buffer, string_length, KAL_TRUE);
#if 0
#ifdef __BTVCSR_HP__
/* under construction !*/
/* under construction !*/
#endif
#endif
   return;
}



/*****************************************************************************
* FUNCTION
*  dt_final_rsp_generator
* DESCRIPTION
*  the function generates the information response and final result code to DTE.
* PARAMETERS
*  kal_uint8 	src_id : l4c_source_enum (channel)
*  kal_bool	ret_val :  OK/ERROR
*  kal_uint8* 	buffer
*  kal_uint8	string_length:  the length of buffer.
* RETURNS
*  none.
* GLOBALS AFFECTED
*  none.
*****************************************************************************/
void dt_final_rsp_generator(kal_uint8 src_id, kal_bool ret_val, kal_uint8* buffer, kal_uint16 string_length)
{
    if (ret_val == KAL_TRUE)
    {
    	if(string_length>0)
    	{
        	dt_write_to_uart((kal_uint8 *)buffer, string_length, KAL_TRUE);
    	}
        dt_result_code_fmttr (DT_RCODE_OK, DT_NO_ERR);
    }
    else
    {
        dt_result_code_fmttr(DT_RCODE_ERROR, DT_PTR->cmee_err);
        DT_PTR->cmee_err = DT_ERR_UNSPECIFIED;  //back to initial value.
    }
}


#ifdef DATA_DOWNLOAD
/******************************************************************
 * FUNCTION
 *    dt_eq_fs_read_rrsp
 * DESCRIPTION
 *    This function is used to handle the response of reading download files from MT.
 * PARAMETERS
 *
 * RETURNS
 *
 * GLOBALS AFFECTED
 *
 ******************************************************************/
void dt_eq_fs_read_rrsp( kal_uint8 * download_ptr,dt_app_type_enum app_type,kal_uint32 length,
										kal_uint8 eof_flag, kal_uint16 loop)
{
#if !(defined(__SLIM_AT__) || defined( __EM_AT_ONLY__))
       kal_uint16 string_length;
   	kal_uint8 buffer[DT_MAX_DATA_OUTPUT_QUEUE_LENGTH];
	kal_uint32 i; //using to convert each element in *data byte stream
	kal_char  buff[512]; //using to store the hex character and end of string character
	kal_uint32 out_len; //using to keep write len
	kal_uint32 offset=0;
	kal_uint16 data_len;
	kal_uint8 data1;
       kal_uint8 data2;

	kal_trace(TRACE_FUNC, FUNC_DT_EQ_READ_RRSP_ENTRY);

	out_len = length;
	if(out_len==0) /* only possible when eof_flag=1 */
	{
		DT_PTR->arg_list[0] = (void *)&loop;
	       DT_PTR->arg_list[1] = (void *)&eof_flag;

	    	if(app_type == DT_IMAGE)
	    	{
	       	string_length = dt_fast_string_print (
				        	buffer,
				        	(kal_uint8 *)"+EIMG: %u, %d, 0",
				        	DT_PTR->arg_list,
				        	2
				        	);
	    	}
		else if((app_type == DT_IMELODY)||(app_type == DT_SOUND_OTHER))
		{
			string_length = dt_fast_string_print (
				        	buffer,
				        	(kal_uint8 *)"%c%c+EMDY: %u, %d, 0",
				        	DT_PTR->arg_list,
				        	2
				        	);
		}
		else
		{
			string_length = dt_fast_string_print (
				        	buffer,
				        	(kal_uint8 *)"%c%c+EFSR: %u, %d, 0",
				        	DT_PTR->arg_list,
				        	2
				        	);
		}
		
		dt_write_to_uart((kal_uint8 *)buffer, string_length, KAL_TRUE);

	}
	
	while (out_len >0 )
	{
		 if(out_len<=DT_DOWNLOAD_SIZE)//cage_read
		 {
			data_len=out_len;
		 }
		 else		//each +EIMG or +EMDY print at most 64 bytes
		 {
		 	data_len=DT_DOWNLOAD_SIZE;//cage_read
		 }
 		 DT_PTR->arg_list[0] = (void *)&DT_PTR->s_reg.s3;
 		 DT_PTR->arg_list[1] = (void *)&DT_PTR->s_reg.s4;
		 DT_PTR->arg_list[2] = (void *)&loop;
	        DT_PTR->arg_list[3] = (void *)&eof_flag;
	        DT_PTR->arg_list[4] = (void *)&data_len;

		 if(app_type == DT_IMAGE)
		 {
	       		string_length = dt_fast_string_print (
					        	buffer,
					        	(kal_uint8 *)"%c%c+EIMG: %u, %d, %u, \"",
					        	DT_PTR->arg_list,
					        	5
					        	);
		 }
		else if((app_type == DT_IMELODY)||(app_type == DT_SOUND_OTHER))
		{
				string_length = dt_fast_string_print (
					        	buffer,
					        	(kal_uint8 *)"%c%c+EMDY: %u, %d, %u, \"",
					        	DT_PTR->arg_list,
					        	5
					        	);
		}
		else
		{
				string_length = dt_fast_string_print (
					        	buffer,
					        	(kal_uint8 *)"%c%c+EFSR: %u, %d, %u, \"",
					        	DT_PTR->arg_list,
					        	5
					        	);
		}
		
		dt_write_to_uart((kal_uint8 *)buffer, string_length, KAL_FALSE);

		for (i=offset; i<(offset+DT_DOWNLOAD_SIZE); i++) //transfer each byte into hex string, each time print at most 64 bytes//cage_read
	   	{
	   		if( i==length) break;

	   		data1 = (download_ptr[i] & 0xF0) >> 4;
			data2 = (download_ptr[i] & 0x0F);

			if(data1 <= 9)      
			 	data1 += 0x30;
			else if((data1 >= 0xA) && (data1 <= 0xF))      
			   	data1 += 0x37;

			if(data2 <= 9)      
			   	data2 += 0x30;
			else if((data2 >= 0xA) && (data2 <= 0xF))      
			   	data2 += 0x37;

                     buff[2*i]=data1;
                     buff[2*i+1]=data2;
	      		out_len--;
   		}
	
                dt_write_to_uart((kal_uint8 *)buff, (kal_uint16)(length*2), KAL_FALSE); 

		offset=i;
	   	DT_PTR->arg_list[0] = (void *)&DT_PTR->s_reg.s3;
		DT_PTR->arg_list[1] = (void *)&DT_PTR->s_reg.s4;
     		string_length = dt_fast_string_print (buffer,
									        (kal_uint8 *)"\"%c%c",
									        DT_PTR->arg_list,
									        2
									        );
    		
	      dt_write_to_uart((kal_uint8 *)buffer, string_length, KAL_FALSE);
	}
#endif
}

#endif /* DATA_DOWNLOAD*/

⌨️ 快捷键说明

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