📄 rt5time.c
字号:
/************************************************************************/
/** Copyright (c) 1998, UTStarcom, Inc. */
/** All Rights Reserved. */
/** */
/** Subsystem: RT */
/** File: rt5time.c */
/** Created By: tara zhang */
/** Created On: 08/02/2003 */
/** */
/** Purpose: */
/** This file handle time . */
/** */
/** Necessary Compilation Flags: FLAG_1, , FLAG_N */
/********************************************************************** */
/** Modify by: */
/** Modify purpose: */
/************************************************************************/
#ifndef PM_ONPC
#define __RTTIME_C_
#include "rt.h"
/********************************************************************************************************/
/* */
/* NUMBER */
/* CALL void rt_tr001p */
/* PARAM timer timeout triggle this function */
/* DISCRIPTION: if timer TR001P timeout,select another csid to link channel establish */
/* */
/* RETURN: */
/********************************************************************************************************/
U1 rt_tr001p(void)
{
#ifdef SIMU_ON_PC
U2 buff[2];
#endif
#ifdef _DEBUG_TC6_
_SendStringToUart("rt_tr001p\n",sizeof("rt_tr001p\n"));
#endif
if ( Lchercnt < LCHERMAX )
{
if ( Rt_tim & TR001ON ) /* if TR001P is ON */
{
Rt_tim &= ~TR001ON; /* stop timer tr001P*/
}
else if ( Rt_tim & TR101ON ) /* if tr101P is on */
{
Rt_tim &= ~TR101ON; /* stop timer tr101p */
cch_est_req(SYS_FREQ, SYS_CSID_P, GAIN_M); /* cch establish request */
switch ( Rtlchdat[0] )
{
case LCHRQ: /* link channel establish request message*/
Rtlchdat[3] &= 0x07;
Rtlchdat[3] |= 0x30;
Rtlchdat[0]++;
break;
}
Rt_sts = ST_LCH_RREQ;
}
move_up_b( tx_cac, Rtlchdat, 5 );
#ifdef SIMU_ON_PC
SendUart2L1(SIMTSKDTW,TXCAC, 0 ,tx_cac,sizeof(tx_cac));
ph_dt_req( L1_SCCH, DMY, OFF,0 );
#else
ph_dt_req( L1_SCCH, DMY, OFF );
#endif
Lchercnt++;
}
else
{ /* link channel establish failed */
if((Rt_sts == ST_LCH_REQ) || (Rt_sts == ST_LCH_RREQ) || (Rt_sts == ST_LCH_ASG))
{
if ( Rt_tim & TR001ON )
{
OUT_LCHEVT->msg_dat[4] = 1; /* timer tr001 timeout */
}
else if ( Rt_tim & TR101ON )
{
OUT_LCHEVT->msg_dat[4] = 4; /* timer tr101 timeout */
}
Rt_tim &= ~(TR001ON | TR101ON); /* stop timer tr001p abd tr101P */
SYS_WORK->tsk_id = TASKMNG; /* send failed message to high level */
OUT_LCHEVT->evt_cod = ERT;
OUT_LCHEVT->pri_cod = PSLCHNG;
OUT_LCHEVT->msg_dat[5] = Lchercnt;
m_excreq( (WORD*)&SYS_WORK->tsk_id );
Rt_sts = ST_WAIT;
}
else if((Rt_sts == ST_RLCH_REQ) || (Rt_sts == ST_RLCH_RREQ))
{
Rt_tim &= ~(TR001ON | TR101ON);
rt_recall_lch_send(); /* select another csid to link channel establish */
}
}
return (0);
}
/********************************************************************************************************/
/* */
/* NUMBER */
/* CALL void rt_recall_tr001p */
/* PARAM timer timeout triggle this function */
/* DISCRIPTION: if timer TR001P timeout,select another csid to link channel establish */
/* in recall switch state */
/* */
/* RETURN: */
/********************************************************************************************************/
//U1 rt_recall_tr001p(void)
//{
// if ( Lchercnt < LCHERMAX )
// {
// if ( Rt_tim & TR001ON ) /* if TR001P is ON */
// {
// Rt_tim &= ~TR001ON; /* stop timer tr001P*/
// }
// if ( Rt_tim & TR101ON ) /* if tr101P is on */
// {
// Rt_tim &= ~TR101ON; /* stop timer tr101p */
// cch_est_req(SYS_FREQ, SYS_CSID_P, GAIN_M); /* cch establish request */
//
// switch ( Rtlchdat[0] )
// {
// case LCHRQ: /* link channel establish request message*/
// Rtlchdat[0]++;
// Rtlchdat[3] &= 0x07;
// Rtlchdat[3] |= 0x30;
// break;
// }
// Rt_sts = ST_RLCH_RREQ;
// }
// move_up_b( tx_cac, Rtlchdat, 5 );
// rt_tm_start( TRCCHESTON );
// ph_dt_req( L1_SCCH, DMY, OFF );
// Lchercnt++;
// }
// else
// {
// Rt_tim &= ~(TR001ON | TR101ON);
// rt_recall_lch_send(); /* select another csid to link channel establish */
// }
// return (0);
//}
/********************************************************************************************************/
/* */
/* NUMBER 13 */
/* CALL void rt_tr101p */
/* PARAM timer timeout triggle this function */
/* DISCRIPTION: Without unwanted signal in the TCH designated by "Link channel
assignment"( including link channel assign,switch-type switch link channel assign,
recall-type switch link channel assign) */
/* RETURN: */
/********************************************************************************************************/
U1 rt_tr101p(void)
{
Rt_tim &= ~TR101ON;
txstp_req(TCH1);
rt_tchold(1);
Tchrests = 0;
return (3);
}
/********************************************************************************************************/
/* */
/* NUMBER 13 */
/* CALL void rt_tr103p */
/* PARAM timer timeout triggle this function */
/* DISCRIPTION: In communication process,if there have some error, result in TX OFF,
RT will wait old tch sync message from cs.
when switch-type or recall-type switching,if ther occurs error
(unwanted wave,doesn't new cs list),RT wait old tch sync message. */
/* RETURN: */
/********************************************************************************************************/
U1 rt_tr103p(void)
{
rt_trstp();
Rt_tim &= ~TR103ON;
SYS_WORK->tsk_id = TASKMNG;
OUT_PRIEVT->evt_cod = ERT;
OUT_PRIEVT->pri_cod = PSSYNNG;
m_excreq( (WORD*)&SYS_WORK->tsk_id );
switch ( Tchre_id )
{
case PS_TCHRES:
case PS_RESHND:
Tchrrcnt = 0;
break;
case PS_HNDLCH:
case CS_HNDLCH:
Lchercnt = 0;
break;
}
Tchre_id = 0;
//Rt_sts = ST_WAIT;
Rt_sts = (U1)rt_state_table->state;
return (0);
}
U1 rt_tr105p(void)
{
Rt_tim &= ~TR105ON;
#ifdef _DEBUG_TC6_
_SendStringToUart("rt_tr105p\n",sizeof("rt_tr105p\n"));
#endif
rt_tm_stop( TR001ON );
rt_tm_stop( TR101ON );
if ( Rt_tim & TR306ON )
{
rt_tm_stop( TR306ON );
cch_m_stp();
}
rt_tchold(3);
return (0);
}
U1 rt_tr301p(void)
{
if ( Tchrrcnt < TCHRRMAX )
{
SYS_WORK->tsk_id = TASKL2;
OUT_DLDEVT->evt_cod = EDLUDTRQ;
OUT_DLDEVT->dl_typ = FACCH;
OUT_DLDEVT->dl_id = SLOT1;
OUT_DLDEVT->dl_sou = 0;
OUT_DLDEVT->msg_adr = (RT_MSGDAT *)m_hntbuf();
OUT_MSGDAT->len = 4;
OUT_MSGDAT->dat[0] = RT_ID;
OUT_MSGDAT->dat[2] = CAUSE;
OUT_MSGDAT->dat[3] = 0x66;
switch ( Rt_sts )
{
case ST_TCH_REQ :
OUT_MSGDAT->dat[1] = RTL2_TCH_SWITCH_REQ;
break;
case ST_TCH_RREQ:
OUT_MSGDAT->dat[1] = RTL2_TCH_SWITCH_RREQ;
break;
}
m_excreq( (WORD*)&SYS_WORK->tsk_id );
Tchrrcnt++;
rt_tm_start( TR301ON );
}
else
{
Rt_tim &= ~TR301ON;
SYS_WORK->tsk_id = TASKMNG;
OUT_PRIEVT->evt_cod = ERT;
OUT_PRIEVT->pri_cod = PSTCHARE;
OUT_PRIEVT->add_dat = 0;
m_excreq( (WORD*)&SYS_WORK->tsk_id );
Tchrrcnt = 0;
Rt_sts = ST_TCH_ACT;
}
return (0);
}
U1 rt_tr3021p(void)
{
Rt_tim &= ~TR3021ON;
set_up_b((U1 *)SYS_WORK->out_evt, 0, sizeof(SYS_WORK->out_evt));
SYS_WORK->tsk_id = TASKMNG;
OUT_PRIEVT->evt_cod = ERT;
OUT_PRIEVT->pri_cod = PSRTFUNG;
m_excreq( (WORD*)&SYS_WORK->tsk_id );
return (0);
}
U1 rt_tr3022p(void)
{
Rt_tim &= ~TR3022ON;
set_up_b((U1 *)SYS_WORK->out_evt, 0, sizeof(SYS_WORK->out_evt));
SYS_WORK->tsk_id = TASKMNG;
OUT_PRIEVT->evt_cod = ERT;
OUT_PRIEVT->pri_cod = PSRTFUNG;
m_excreq( (WORD*)&SYS_WORK->tsk_id );
return (0);
}
U1 rt_tr304p(void)
{
Rt_tim &= ~TR304ON;
SYS_WORK->tsk_id = TASKMNG;
OUT_PRIEVT->evt_cod = ERT;
OUT_PRIEVT->pri_cod = PSRTFUNG;
OUT_PRIEVT->add_dat = BIT1;
m_excreq( (WORD*)&SYS_WORK->tsk_id );
return (0);
}
U1 rt_tr305p(void)
{
Rt_tim &= ~TR305ON;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -