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

📄 l3cmain.c

📁 phs 源代码 小灵通协议源代码 phs source code
💻 C
📖 第 1 页 / 共 2 页
字号:

	SYS_WORK->tsk_id = TASKMNG;			/* set task id*/
	OUT_DLDEVT->evt_cod = EL3FRERS;			/* set event code	*/
	OUT_DLDEVT->dl_typ = 0;   			/* free cause:normal */
	if ( L3_dl[IN_DLDEVT->dl_typ-1] == ST_SET )	/* if channel state is P2 state*/
	{
		OUT_DLDEVT->dl_typ = 2;
	}
	OUT_DLDEVT->add_dat[0] = (U2)Sys_ccsinf[2];	/* cs info	*/
	OUT_DLDEVT->add_dat[1] = IN_DLDEVT->dl_typ;	/*channel id	*/
	m_excreq( (WORD*)&SYS_WORK->tsk_id );			/* send out 	*/

	L3_dl[OUT_DLDEVT->add_dat[1]-1] = ST_OPN;	/* channel id change to P0 state */
}

/************************************************************************/
/*                                                                      */
/*		NUMBER		8				        */
/*		CALL		void L3cDataLinkFreeIndAtP1()                      */
/*		PARAM						        */
/*		FUNC		handle free data link indication message at P1 state*/
/*		RETURN		void                         */
/*		GLOBAL      Sys_work	 :input and output message pointer*/
/*                  Sys_ccsinf   :  cs info                		*/
/*                  L3_dl[2]	 :  channel id state           	*/
/*                                                                      */
/************************************************************************/
void L3cDataLinkFreeIndAtP1(void)
{
	if ( IN_DLDEVT->add_dat[1] == 0 )
	{/* free cause is request link failed 	*/
		/*send free indication message(MNG <- L3 <- L2) -----------------------*/

		SYS_WORK->tsk_id = TASKMNG;			/* set task id*/
		OUT_DLDEVT->evt_cod = EL3FRERS;			/* set event code	*/
		OUT_DLDEVT->dl_typ = 1;				/* free cause:request link failed  */
		OUT_DLDEVT->add_dat[0] = (U2)Sys_ccsinf[2];	/* cs info	*/
		OUT_DLDEVT->add_dat[1] = IN_DLDEVT->dl_typ;	/*channel id	*/
		m_excreq( (WORD*)&SYS_WORK->tsk_id );			/* send out 	*/

		L3_dl[OUT_DLDEVT->add_dat[1]-1] = ST_OPN;	/* channel id change to P0 state */
	}
}

/************************************************************************/
/*                                                                      */
/*		NUMBER		9				        */
/*		CALL		void L3cDldtrs()                       */
/*		PARAM						        */
/*		FUNC		handle data trans complete indicate message*/
/*		RETURN		void                */
/*		GLOBAL      Sys_work	 :input and output message pointer					*/
/*                  L3_dl[2]	 :  channel id state       */
/*                                                                      */
/************************************************************************/
void L3cDldtrs(void)
{
	/* send free data link request message  (L2 -> L3 -> L2) ----------------------------*/

	SYS_WORK->tsk_id = TASKL2;			/*set task id	*/
	OUT_DLDEVT->evt_cod = EDLFRERQ;				/* set event code	*/
	OUT_DLDEVT->dl_typ = IN_DLDEVT->dl_typ;		/*channel id	*/
	OUT_DLDEVT->dl_id = SLOT1;			/* time slot	*/
	m_excreq( (WORD*)&SYS_WORK->tsk_id );				/* send out	*/

	L3_dl[OUT_DLDEVT->dl_typ - 1] = ST_FRE_WT;	/* channel id state change to P3 state	*/

	if ( IN_DLDEVT->dl_typ == FACCH )		/* FACCH channel */
	{
		if ( L3_dl[SACCH_ST] == ST_SET )	/* sacch channel state is P2 state */
		{
			OUT_DLDEVT->dl_typ = SACCH;		/* free sacch channel	*/
			m_excreq( (WORD*)&SYS_WORK->tsk_id );		/* send out			*/
			L3_dl[SACCH_ST] = ST_FRE_WT;		/* sacch channel state change to P3 state	*/
		}
	}
	else	/* SACCH channel*/
	{
		if ( L3_dl[FACCH_ST] == ST_SET )		/*sacch channel state is P2 state */
		{
			OUT_DLDEVT->dl_typ = FACCH;		/* free facch channel	*/
			m_excreq( (WORD*)&SYS_WORK->tsk_id );		/* send out	*/
			L3_dl[FACCH_ST] = ST_FRE_WT;		/* facch channel state change to P3 state	*/
		}
	}
}

/************************************************************************/
/*                                                                      */
/*		NUMBER		10				        */
/*		CALL		void L3cDldtds()                       */
/*		PARAM						        */
/*		FUNC		                 		*/
/*		RETURN		void                */
/*		GLOBAL      Sys_work	 :input and output message pointer*/
/*                                                                      */
/************************************************************************/
void L3cDldtds(void)
{
	SYS_WORK->tsk_id = TASKMNG;					/* set task id*/
	move_up_b( (U1 *)SYS_WORK->out_evt, (U1 *)SYS_WORK->in_evt,sizeof(SYS_WORK->in_evt) );

	m_excreq( (WORD*)&SYS_WORK->tsk_id );	 /* send out */
}

/************************************************************************/
/*                                                                      */
/*		NUMBER		10'				        */
/*		CALL		void L3cMdlErr()                       */
/*		PARAM						        */
/*		FUNC			              	*/
/*		RETURN		void                      */
/*		GLOBAL      Sys_work	 :input and output message type	*/
/*                                                                      */
/************************************************************************/
void L3cMdlErr(void)
{
	/* 俵俢俴亅僄儔乕昞帵憲弌 (MNG <- L3 <- L2) ------------------------*/

	SYS_WORK->tsk_id = TASKMNG;		/* set task id	*/
	move_up_b( (U1 *)SYS_WORK->out_evt, (U1 *)SYS_WORK->in_evt,sizeof(SYS_WORK->in_evt) );

	m_excreq( (WORD*)&SYS_WORK->tsk_id );		/* send out	*/
}

/************************************************************************/
/*                                                                      */
/*		NUMBER		11				        */
/*		CALL		void L3cPhdtds()                       */
/*		PARAM						        */
/*		FUNC		handle PH event from L1 layer           */
/*		RETURN		void                   */
/*		GLOBAL      Sys_work	 :	input a nd output messag pointer*/
/*                  Sys_pch  	 :  reveived pch date      */
/*                  rx_cac  	 :  received data            		*/
/*                                                                      */
/************************************************************************/
void L3cPhdtds(void)
{


	/* broadcast message(MNG <- L3 <- L1) -----------------------------------------*/

	switch ( IN_PHDEVT->ch_id )	/* message type*/
	{
		case L1_BCCHA	:		/* BCCH(A):*/
		case L1_BCCHB	:		/* BCCH(B):	*/
			switch ( rx_cac[0] )/* broadcast message type	*/
			{
				case RCHINFO:	/* radio channel information broadcasting */
					OUT_PHDEVT->evt_cod = ERCHINFO;  /* set radio channel information broadcasting type */
					break;
				case SYSINFO:	/* system information broadcasting	*/
					OUT_PHDEVT->evt_cod = ESYSINFO; /*set  system information broadcasting type */
					break;
				case SY2INFO:	/* 2nd system information broadcasting */
					OUT_PHDEVT->evt_cod = ESY2INFO; /*set  2nd system information broadcasting type */
					break;
				default:	/* 3rd system information broadcasting*/
					OUT_PHDEVT->evt_cod = ESY3INFO;  /*set  3rd system information broadcasting type */

			}
#ifdef EXT_IO
			HisOut(8, 0x3b, rx_cac[0], (U1)IN_PHDEVT->ch_id, rx_cac);
#endif
			break;


		case L1_PCH	:/*paging message */
			OUT_PHDEVT->evt_cod = EPCH;/* set paging message type	*/
#ifdef EXT_IO
			HisOut(8, 0x3c, L1_PCH, Mn_state.public_mod, rx_cac);
#endif
			break;
		case L1_NULL	:
		case L1_SCCH	:/* SCCH*/
			OUT_PHDEVT->evt_cod = ESCCH;/* set scch message type	*/
#ifdef EXT_IO
			HisOut(0, 0x3d, (BYTE)IN_PHDEVT->ch_id, Mn_state.public_mod, 0);
#endif
			break;
		default			:
			return;
	}
     move_up_b( Sys_cch, rx_cac, 8);	/* copy received data	*/


	SYS_WORK->tsk_id = TASKMNG;	/* set task id	*/
	OUT_PHDEVT->ch_id = IN_PHDEVT->ch_id;		/* messsage type	*/
	move_up_b( (U1*)OUT_PHDEVT->msg_dat, (U1*)IN_PHDEVT->msg_dat, 6);

	m_excreq( (WORD*)&SYS_WORK->tsk_id );				/* send out	*/
}

/************************************************************************/
/*                                                                      */
/*		NUMBER		12				        */
/*		CALL		void L3cInitReq()                       */
/*		PARAM						        */
/*		FUNC		init data link channel             */
/*		RETURN		void                 */
/*		GLOBAL      Sys_work	 :	input and output message poiner*/
/*                  L3_dl[2]	 :  sacch and facch state丂            */
/*                                                                      */
/************************************************************************/
void L3cInitReq(void)
{
	/* 俢俴亅send initial request(MNG -> L3 -> L2) --------------------------*/

	SYS_WORK->tsk_id = TASKL2;	/* set task id	*/
	OUT_DLDEVT->evt_cod = EDLINITRQ;	/* set event code	*/
	if(IN_DLDEVT->add_dat[1] == 0)
		OUT_DLDEVT->dl_id = 0x00FF;/* all tch	*/
	else
		OUT_DLDEVT->dl_id = 1;	/* tch2	*/

	m_excreq( (WORD*)&SYS_WORK->tsk_id );		/* send out	*/

	if(IN_DLDEVT->add_dat[1] == 0)
	{
		L3_dl[SACCH_ST] = ST_OPN;		/* sacch channel state(0)*/
		L3_dl[FACCH_ST] = ST_OPN;		/* facch channel state(0)*/
	}
}

/************************************************************************/
/*                                                                      */
/*		NUMBER		--				        */
/*		CALL		void L3cDlFree()                       */
/*		PARAM						        */
/*		FUNC		handle free data link request message   */
/*					BUGNo.IT-045			*/
/*		RETURN		void               */
/*		GLOBAL      Sys_work	 :input and output message pointer*/
/*                  L3_dl[2]	 :  channel id state          */
/*                                                                      */
/************************************************************************/
void L3cDlFree(void)
{
	/* send free data link request messsage(facch channel) (MNG -> L3 -> L2) ---------------------*/
	if ( L3_dl[FACCH_ST] == ST_SET )		/* facch channel state is P2 state	*/
	{
		SYS_WORK->tsk_id = TASKL2;			/*set task id		*/
		OUT_DLDEVT->evt_cod = EDLFRERQ;		/* set event code	*/
		OUT_DLDEVT->dl_typ = FACCH;			/* facch channel*/
		OUT_DLDEVT->dl_id = SLOT1;			/* slot timer	*/
		m_excreq( (WORD*)&SYS_WORK->tsk_id );		/* send out		*/

		L3_dl[FACCH_ST] = ST_FRE_WT;		/* facch channel state change to P3 state	*/
	}

	/* send free data link request messsage(sacch channel) (MNG -> L3 -> L2) ---------------------*/
	if ( L3_dl[SACCH_ST] == ST_SET ) 		/* sacch channel state is P2 state	*/
	{
		SYS_WORK->tsk_id = TASKL2;			/*set task id		*/
		OUT_DLDEVT->evt_cod = EDLFRERQ;		/* set event code	*/
		OUT_DLDEVT->dl_typ = SACCH;			/* sacch channel*/
		OUT_DLDEVT->dl_id = SLOT1;			/* slot timer	*/
		m_excreq( (WORD*)&SYS_WORK->tsk_id );		/* send out		*/

		L3_dl[SACCH_ST] = ST_FRE_WT;		/* facch channel state change to P3 state	*/
	}
}

#ifdef __cplusplus
}
#endif


#endif

⌨️ 快捷键说明

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