📄 cc2req.c
字号:
/************************************************************************/
/** Copyright (c) 1998, UTStarcom, Inc. */
/** All Rights Reserved. */
/** */
/** Subsystem: CC */
/** File: cc2req.c */
/** Created By: tara zhang */
/** Created On: 08/02/2003 */
/** */
/** Purpose: */
/** This file handle received message from L2 . */
/** */
/** Necessary Compilation Flags: FLAG_1, , FLAG_N */
/********************************************************************** */
/** Modify by: */
/** Modify purpose: */
/************************************************************************/
#ifndef PM_ONPC
#define __CC2REQ_C_
#ifdef __cplusplus
extern "C"{
#endif
#include "cc.h"
/************************************************************************/
/*Function Name : cc_setup_req */
/*Function : handle setup request message at P0,P10 state */
/* Process : */
/* Comment : parse setup message from MN,then send message to L2 */
/* Author : tara zhang */
/* Time : 2003/08/02 */
/* Return Value : none */
/* Parameter : none */
/************************************************************************/
/** Modify by: MMM, MM/dd/yy */
/** Modify purpose: */
/************************************************************************/
void cc_setup_req( )
{
// U1 len_plus;
U2 length = IN_PRIEVT->inf_len; /* input message data length */
U1 info_len = 0;
U1 *input_ptr = IN_PRIEVT->inf_adr; /* input message data pointer */
U1 *output_ptr = NULL; /* output message data pointer */
int i;
U1 ret = NG_FF;
if ((( Cc_sts == ST_ACTV ) && ( IN_PRIEVT->add_dat & BIT8 )) /* in comminication state,recall state */
|| (( Cc_sts == ST_NULL ) && (!( IN_PRIEVT->add_dat & BIT8 )))) /* normal */
{
Cc_txnum = 1; /* call reference(sending */
Cc_rxnum = Cc_txnum | BIT8; /* call reference(receiving)*/
OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( ); /* get memory */
if(OUT_DLDEVT->msg_adr == NULL)
return;
//OUT_MSGDAT->dat = OUT_DLDEVT->msg_adr +MSB_S;
OUT_MSGDAT->len = 4; /* send message header length */
output_ptr = (U1*)&OUT_MSGDAT->dat[4]; /* output message data pointer */
while(input_ptr < IN_PRIEVT->inf_adr + length)
{
info_len = input_ptr[1] +2; /* every information element length */
if ( info_len < 2 )
info_len = 0xFF;
for( i = 0; i < SETUP_ELEMENT_CNT; i++ ) /* match message information element in table */
{
if(*input_ptr == cc_setup_info[i].element_id)
{
ret = cc_info_element_chk(input_ptr);
if(*input_ptr & BIT8) /* single information element */
info_len = 1;
move_up_b( output_ptr, input_ptr, info_len );
PACKED_INT(output_ptr) += info_len;
PACKED_INT(input_ptr) += info_len;
OUT_MSGDAT->len += info_len;
break;
}
}
}
//SYS_WORK->call_reference = Cc_txnum;
//SYS_WORK->call_reference_value = Cc_txnum;
#ifdef EXT_IO
HisOut(0,0xda,0x0a,0,0);
#endif
cc_msg_write( CCL2_SETUP ); /* write setup message */
Cc_ko_set_p = m_hntbuf( ); /* get memory */
*(Cc_ko_set_p+L3_MSGDMY) = OUT_MSGDAT->len; /* length */
move_up_b( Cc_ko_set_p+L3_MSGDMY+1, (U1*)OUT_MSGDAT->dat, OUT_MSGDAT->len); /* copy information element */
m_excreq( (U2*)&SYS_WORK->tsk_id ); /* send out */
cc_set_time( TC303ON ); /* start timer tc303P */
Cc_timcm &= ~TC303ON; /* first start tc303P timer */
if( Cc_sts == ST_ACTV ) /* in communication state */
{
Cc_recall_flg = 1; /* recall state */
}
if(p_state_table->state != 0xff) //zch0710
{
Cc_sts = (U1)p_state_table->state; /* cc state change to P1 state */
}
}
}
/************************************************************************/
/*Function Name : cc_connect_req */
/*Function : handle connect message to cs at P7,p9 state */
/* Process : */
/* Comment : parse connect message from MN,then send message to L2 */
/* Author : tara zhang */
/* Time : 2003/08/02 */
/* Return Value : none */
/* Parameter : none */
/************************************************************************/
/** Modify by: MMM, MM/dd/yy */
/** Modify purpose: */
/************************************************************************/
void cc_connect_req( )
{
// U1 len_plus;
U2 length = IN_PRIEVT->inf_len; /* input message data length */
U1 info_len = 0;
U1 *input_ptr = IN_PRIEVT->inf_adr; /* input message data pointer */
U1 *output_ptr = NULL; /* output message data pointer */
int i;
U1 ret = NG_FF;
OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( ); /* get memory*/
//OUT_MSGDAT->dat = OUT_DLDEVT->msg_adr +MSB_S;
OUT_MSGDAT->len = 4; /* send message header length */
output_ptr = (U1*)&OUT_MSGDAT->dat[4]; /* output message data pointer */
while(input_ptr < IN_PRIEVT->inf_adr + length)
{
info_len = input_ptr[1] +2; /* every information element length */
if ( info_len < 2 )
info_len = 0xFF;
for( i = 0; i < CONNECT_ELEMENT_CNT; i++ ) /* match message information element in table */
{
if(*input_ptr == cc_connect_info[i].element_id)
{
ret = cc_info_element_chk(input_ptr);
if(*input_ptr & BIT8) /* single information element */
info_len = 1;
move_up_b( output_ptr, input_ptr, info_len );
PACKED_INT(output_ptr) += info_len;
PACKED_INT(input_ptr) += info_len;
OUT_MSGDAT->len += info_len;
break;
}
}
}
cc_msg_write( CCL2_CONNECT ); /* write connect message */
m_excreq( (U2*)&SYS_WORK->tsk_id ); /* send out*/
cc_set_time( TC313ON ); /* start timer tc313P */
Cc_sts = ST_CONREQ; /* cc state change to P8 state*/
}
/************************************************************************/
/*Function Name : cc_release_p6_req */
/*Function : handle release message to cs at P6 state */
/* Process : */
/* Comment : parse release message from MN,then send message to L2 */
/* Author : tara zhang */
/* Time : 2003/08/02 */
/* Return Value : none */
/* Parameter : none */
/************************************************************************/
/** Modify by: MMM, MM/dd/yy */
/** Modify purpose: */
/************************************************************************/
void cc_release_p6_req( )
{
//U1 len_plus;
U2 length = IN_PRIEVT->inf_len; /* input message data length */
U1 info_len = 0;
U1 *input_ptr = IN_PRIEVT->inf_adr; /* input message data pointer */
U1 *output_ptr = NULL; /* output message data pointer */
int i;
U1 ret = NG_FF;
if ( IN_PRIEVT->add_dat )
{
OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( ); /* get memory*/
//OUT_MSGDAT->dat = OUT_DLDEVT->msg_adr +MSB_S;
OUT_MSGDAT->len = 4; /* send message header length */
output_ptr = (U1*)&OUT_MSGDAT->dat[4]; /* output message data pointer */
while(input_ptr < IN_PRIEVT->inf_adr + length)
{
info_len = input_ptr[1] +2; /* every information element length */
if ( info_len < 2 )
info_len = 0xFF;
for( i = 0; i < RELEASE_COMP_ELEMENT_CNT; i++ ) /* match message information element in table */
{
if(*input_ptr == cc_release_comp_info[i].element_id)
{
ret = cc_info_element_chk(input_ptr);
if(*input_ptr & BIT8)/* single information element */
info_len = 1;
move_up_b( output_ptr, input_ptr, info_len );
PACKED_INT(output_ptr) += info_len;
PACKED_INT(input_ptr) += info_len;
OUT_MSGDAT->len += info_len;
break;
}
}
}
cc_msg_write( CCL2_RELEASE_COMPLETE ); /* write release coplete message*/
OUT_DLDEVT->dl_sou = 1; /* need transfer confirm */
m_excreq( (U2*)&SYS_WORK->tsk_id ); /* send out */
disconnect_complete_flag = 1;
}
cc_reference_clear(); /* call initial */
}
/************************************************************************/
/*Function Name : cc_proceed_req */
/*Function : handle proceed message to cs at P6 state */
/* Process : */
/* Comment : parse proceed message from MN,then send message to L2 */
/* Author : tara zhang */
/* Time : 2003/08/02 */
/* Return Value : none */
/* Parameter : none */
/************************************************************************/
/** Modify by: MMM, MM/dd/yy */
/** Modify purpose: */
/************************************************************************/
void cc_proceed_req( )
{
OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( ); /* get memory */
OUT_MSGDAT->len = CC_FMT_SZ; /* message header length */
cc_msg_write( CCL2_PROCEED ); /* write proceed message */
if ( IN_PRIEVT->add_dat ) /* need transfer confirm */
{
OUT_DLDEVT->dl_sou = 1; /* need transfer confirm */
disconnect_complete_flag = 4;
}
m_excreq( (U2*)&SYS_WORK->tsk_id ); /* send out */
if(p_state_table->state != 0xff)
{
Cc_sts = (U1)p_state_table->state; /* cc state change to P9 state */
}
}
/************************************************************************/
/*Function Name : cc_alert_req */
/*Function : handle alert message to cs at P9 state */
/* Process : */
/* Comment : parse alert message from MN,then send message to L2 */
/* Author : tara zhang */
/* Time : 2003/08/02 */
/* Return Value : none */
/* Parameter : none */
/************************************************************************/
/** Modify by: MMM, MM/dd/yy */
/** Modify purpose: */
/************************************************************************/
void cc_alert_req( )
{
// U1 len_plus;
U2 length = IN_PRIEVT->inf_len; /* input message data length */
U1 info_len = 0;
U1 *input_ptr = IN_PRIEVT->inf_adr; /* input message data pointer */
U1 *output_ptr = NULL; /* output message data pointer */
int i;
U1 ret = NG_FF;
OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( ); /* get memory */
//OUT_MSGDAT->dat = OUT_DLDEVT->msg_adr +MSB_S;
OUT_MSGDAT->len = 4; /* message header length */
output_ptr = (U1*)&OUT_MSGDAT->dat[4]; /* output message data pointer */
while(input_ptr < IN_PRIEVT->inf_adr + length)
{
info_len = input_ptr[1] +2; /* every information element length */
if ( info_len < 2 )
info_len = 0xFF;
for( i = 0; i < ALERT_ELEMENT_CNT; i++ ) /* match message information element in table */
{
if(*input_ptr == cc_alert_info[i].element_id)
{
ret = cc_info_element_chk(input_ptr);
if(*input_ptr & BIT8) /* single information element */
info_len = 1;
move_up_b( output_ptr, input_ptr, info_len );
PACKED_INT(output_ptr) += info_len;
PACKED_INT(input_ptr) += info_len;
OUT_MSGDAT->len += info_len;
break;
}
}
}
cc_msg_write( CCL2_ALERT ); /* write alert message */
m_excreq( (U2*)&SYS_WORK->tsk_id ); /* send out */
if(p_state_table->state != 0xff)
{
Cc_sts = (U1)p_state_table->state; /* cc state change to P7 state */
}
}
/************************************************************************/
/*Function Name : cc_infomation_req */
/*Function : handle information message */
/* Process : */
/* Comment : parse information message from MN,then send message to L2 */
/* Author : tara zhang */
/* Time : 2003/08/02 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -