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

📄 mm32ev.c

📁 phs 源代码 小灵通协议源代码 phs source code
💻 C
📖 第 1 页 / 共 2 页
字号:
#ifndef PM_ONPC
#ifdef __cplusplus
extern "C"{
#endif

#include	"phs_def.h"
#include	"mm32.h"
//  #pragma		section area m_data
#include	"l3_ext.h"
#include	"mm32data.h"
#include 	"_Define.h"
//  #pragma		section code mp_code


/*************************************************************************************
FUNCTION: mm_LocReg_req

DESCRIPTION:
	MM Location registration request
	Triggered by MNMM_LOCATION_REGISTRATION_REQ primitive
ARGUMENTS PASSED:
	None.

RETURN VALUE:
	None

Revision History:
                            Modification     Tracking
Author                          Date          Number     Description of Changes
-------------------------   ------------    ----------   ------------------------------
Chen Xiangli					08/06/2003					Initial version.

**************************************************************************************/
void mm_LocReg_req( void )
{
	//U1	i;

		//here may call mm_pack_dld for test if there exist the PS num in iN_PRIEVT->adr !
		//on the other hand ,why PW_OFF_MSG is not listed in STD-28 ? is it defined by user?
	OUT_DLDEVT->msg_adr = (MM_MSGDAT *)m_hntbuf();

	OUT_MSGDAT->next_po = NULL;
	OUT_MSGDAT->len = 10;		//==3(data[0]~[2]) + 7(PS number length)
	OUT_MSGDAT->dat[0] = MM_ID;

/* #J88 -> */
	if ( IN_PRIEVT->add_dat == 2 )				/* Location registration type	*/
	{											/* PS Power Off location registration	*/
		OUT_MSGDAT->dat[1] = PW_OFF_MSG;		/* PS power-off message	*/
	}
/* <- #J88 */
	else
	{
		OUT_MSGDAT->dat[1] = MML2_LOCATION_REGISTRATION_REQ;

	}

	OUT_MSGDAT->dat[2] = MMINFOELE_PS_NUMBER;

	move_up_b((U1*)&OUT_MSGDAT->dat[3], Sys_psno, 7);/*PS Number ,the length is 7*/

	mm_dldt_req(FACCH);

	mm_set_time( TM303PON );		/*
										60s, start at: Location registration request  tranmission
											 stop at:  Location registration acknowledge or location registration reject
								*/

	Mm_bLocReg = TRUE;
}


/*************************************************************************************
FUNCTION: mm_fnc_req

DESCRIPTION:
	MM Function request
	Triggered by MNMM_FUNCTION_REQ primitive
ARGUMENTS PASSED:
	None.

RETURN VALUE:
	None

Revision History:
                            Modification     Tracking
Author                          Date          Number     Description of Changes
-------------------------   ------------    ----------   ------------------------------
Chen Xiangli					08/06/2003					Initial version.

**************************************************************************************/
void mm_fnc_req( void )
{
	U1 *point;

	OUT_DLDEVT->msg_adr = (MM_MSGDAT *)m_hntbuf();
	OUT_MSGDAT->next_po = NULL;
	OUT_MSGDAT->len = 2;
	OUT_MSGDAT->dat[0] = MM_ID;
	OUT_MSGDAT->dat[1] = MML2_FUNCTION_REQ ;

	Mm_fncrq = IN_PRIEVT->add_dat;
	point = (U1*)&OUT_MSGDAT->dat[2];
	if ( Mm_fncrq & BIT1 )			// Authentication type
	{
		*point = MMINFOELE_AUTHTYPE;
	  	if ((Sys_initdl1[9] == 0x04) && (Sys_initdl1[10] == 0x4A))
	  	{											/* 擔杮(1098[044Ah])	*/
			*(++point) = Sys_mmfunc[0];				/* 擣徹					*/
	  	}
	  	else/* !UT80_004 */
	  	{
			*(++point) = 0x01;						/* 0x01: Standard authenication function present	*/
	  	}
		OUT_MSGDAT->len += 2;
	}
	if ( Mm_fncrq & BIT2 )						/* Active authentication , whichis used to identify whether or not authentiation is performed during communication*/
	{
	  	if ((Sys_initdl1[9] == 0x04) && (Sys_initdl1[10] == 0x4A))
	  	{															/* 擔杮(1098[044Ah])	*/
			*(++point) =  MMINFOELE_ACTIVE_AUTH | Sys_mmfunc[1];	/* 捠怣拞擣徹			*/
	  	}
	  	else/* !UT80_004 */
	  	{
			*(++point) =  MMINFOELE_ACTIVE_AUTH;
	  	}
		OUT_MSGDAT->len += 1;
	}
	if ( Mm_fncrq & BIT3 )						/*  */
	{
		*(++point) = MMINFOELE_PAGING_AREA;
	  	if ((Sys_initdl1[9] == 0x04) && (Sys_initdl1[10] == 0x4A))
	  	{
			*(++point) = Sys_mmfunc[2];
		}
	  	else/* !UT80_004 */
	  	{
			*(++point) = 0x01;					//Fixed paging area by system information
	  	}
		OUT_MSGDAT->len += 2;
	}

	if ( L3_dl[FACCH_ST] == ST_SET )
	{
		mm_dldt_req(FACCH);
	}
	else
	{
		mm_dldt_req(SACCH);
	}

	mm_set_time( TM301PON );		/*
										1s , start at: MM function request transmission
											 stop  at: MM function request response reception
									*/
}



/*************************************************************************************
FUNCTION: mm_auth_rep

DESCRIPTION:
	MM authentication response , UPLINK
	Triggered by MNMM_AUTHENTICATION_REP primitive
ARGUMENTS PASSED:
	None.

RETURN VALUE:
	None

Revision History:
                            Modification     Tracking
Author                          Date          Number     Description of Changes
-------------------------   ------------    ----------   ------------------------------
Chen Xiangli					08/06/2003					Initial version.

**************************************************************************************/
void mm_auth_rep( void )
{
	OUT_DLDEVT->msg_adr = (MM_MSGDAT *)m_hntbuf();
	OUT_MSGDAT->next_po = NULL;
	mm_pack_dld(mm_auth_rep_msgtype ,sizeof(mm_auth_rep_msgtype)/sizeof(MM_INFOELE));
	if ( IN_PRIEVT->buf_adr )
	{
		m_frebuf( IN_PRIEVT->buf_adr );
	}


	OUT_MSGDAT->dat[0] = MM_ID;
	OUT_MSGDAT->dat[1] = MML2_AUTHENICATION_RES;

	if ( L3_dl[FACCH_ST] == ST_SET )
	{
		mm_dldt_req(FACCH);
	}
	else
	{
		mm_dldt_req(SACCH);
	}


	if ( Mm_bLocReg )
		Mm_sts = ST_LOCREG;
	else
		Mm_sts = ST_NULL;
}



/*************************************************************************************
FUNCTION: mm_auth_req

DESCRIPTION:
	MM Authentication request , DOWNLINK
	Triggered by MNMM_AUTHENTICATION_REQ primitive
ARGUMENTS PASSED:
	None.

RETURN VALUE:
	None

Revision History:
                            Modification     Tracking
Author                          Date          Number     Description of Changes
-------------------------   ------------    ----------   ------------------------------
Chen Xiangli					08/06/2003					Initial version.

**************************************************************************************/

void mm_auth_req( void )
{
	_BOOL	ret;

	OUT_PRIEVT->buf_adr = m_hntbuf();
	ret = mm_unpack_dld(mm_auth_req_msgtype , sizeof(mm_auth_req_msgtype)/sizeof(MM_INFOELE));
	m_frebuf( (U1 *)IN_DLDEVT->msg_adr );

	if ( !ret )
	{
		m_frebuf( OUT_PRIEVT->buf_adr );
		return;
	}

	if ( OUT_PRIEVT->inf_adr[1] & 0xFE )		//inf_adr[0]: Authentication type ID : 0x06
	{											//inf_adr[1]: Authentication type
		m_frebuf( OUT_PRIEVT->buf_adr );		//inf_adr[2]: Authentication Radom Pattern ID : 0x07
		return;									//inf_adr[3]: Authentication Radom Pattern content length
	}

	if ( OUT_PRIEVT->inf_adr[3] != KEYRND_SZ )
	{
		m_frebuf( OUT_PRIEVT->buf_adr );
		return;
	}

	mm_pri_req(MMMN_AUTHENICATION_REQ);
}


/*************************************************************************************
FUNCTION: mm_LocReg_ack

DESCRIPTION:
	MM Location registration acknowledge
	Triggered by MNMM_LOCATION_REGISTRATION_ACK primitive
ARGUMENTS PASSED:
	None.

RETURN VALUE:
	None

Revision History:
                            Modification     Tracking
Modifier                         Date          Number     Description of Changes
-------------------------   ------------    ----------   ------------------------------
Chen Xiangli					08/06/2003					Initial version.

**************************************************************************************/
void mm_LocReg_ack(  void )
{
	_BOOL ret;

	OUT_PRIEVT->buf_adr = m_hntbuf();
	ret = mm_unpack_dld(mm_loc_reg_ack_msgtype , sizeof(mm_loc_reg_ack_msgtype)/sizeof(MM_INFOELE));
	m_frebuf( (U1 *)IN_DLDEVT->msg_adr );

	if ( !ret )
	{
		m_frebuf( OUT_PRIEVT->buf_adr );
		return;
	}

	mm_pri_req(MMMN_LOCATION_REGISTRATION_ACK);

	mm_stop_time( TM303PON );			/*
										60s , Start at: location registration request
											  Stop at:  1.Location  registration ack
											  			2.Location  registration reject
										*/
	Mm_bLocReg = FALSE;

}

⌨️ 快捷键说明

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