📄 rt4schi.c
字号:
Rt_slot =
(abs_slot + (input_ptr[1] & 0x1F)) % 4 + 1;
Rt_radinf.slt_num = Rt_slot;
// info_len = 2;
// move_up_b(output_ptr, input_ptr, info_len);
break;
default:
break;
}
PACKED_INT(output_ptr) += info_len;
PACKED_INT(input_ptr) += info_len;
OUT_PRIEVT->inf_len += info_len;
}
}
}
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
if ( Rt_rcsid[6] == 0 ) /* */
{
Rt_radinf.car_num = 0x00;
Rt_radinf.slt_num = 0xFF;
}
tch_re = 0;
if ( Rt_rcsid[6] ) /* switch-ind message contain csid item*/
{
if( rt_page_area_compare(Rt_rcsid,SYS_CSID_P) ) /* compare commu csid same as switch-ind csid or not */
{/* paging area number is same */
if ( !cmp_up_b( Rt_rcsid, SYS_CSID_P, 6 ))
{/* csid is same */
if ( Rt_radinf.car_num != 0x00&& Rt_radinf.slt_num != 0xFF ) /* switch-ind message contains carrier and slot number */
{
if ( Rt_radinf.car_num == Rt_radbak.car_num )
tch_re = BIT1; /* channel switching during communication(switching on same cs) */
else
tch_re = BIT2; /* carrier switching during communication(switching on same cs )*/
}
else
tch_re = BIT3; /* recall switch in same paging area */
}
else
{
if ( Rt_radinf.car_num != 0x00&& Rt_radinf.slt_num != 0xFF )
tch_re = BIT4; /* tch switch in same paging area */
else/* not csid,support carrier number and slot number */
tch_re = BIT3; /* recall switch in same paging area */
}
}
else /* differ paging area */
{
if ( Rt_radinf.car_num != 0x00&& Rt_radinf.slt_num != 0xFF )
{/* support csid,carrier number,slot number */
if(Call_Loc_NG)
{
m_frebuf(OUT_PRIEVT->buf_adr);
move_up_b((U1 *)&Rt_radinf,(U1 *)&Rt_radbak,sizeof(Rt_radinf));
return (0);
}
tch_re = BIT6; /* tch switch on differ paging area */
}
else
tch_re = BIT5; /* recall switch on differ paging area */
}
}
else /* not support csid */
{
tch_re = (BIT3 | BIT5); /* recall switch */
}
if ( !(tch_re & Sys_rtfunc[4]) )
{/* compare tch switching unit in rt function */
m_frebuf(OUT_PRIEVT->buf_adr);
move_up_b((U1 *)&Rt_radinf,(U1 *)&Rt_radbak,sizeof(Rt_radinf));
return (0);
}
if ( tch_re & (BIT3 | BIT5)) /* recall switch */
{
if ( Sys_hodat[6] != ON )
{
m_frebuf(OUT_PRIEVT->buf_adr);
move_up_b((U1 *)&Rt_radinf,(U1 *)&Rt_radbak,sizeof(Rt_radinf));
return (0);
}
if ( Rt_sts == ST_TCH_ACT )
Tchre_id = CS_HNDLCH; /* switching to ohter cs: recalling-type with cs */
else
Tchre_id = PS_RESHND; /* switching to ohter cs: recalling-type with ps */
OUT_PRIEVT->add_dat = 1; /* switch type: recalling-type */
}
else
{
if ( Rt_sts == ST_TCH_ACT )
Tchre_id = CS_TCHRES; /* switch to other cs: tch switch-type with cs indiction */
else
Tchre_id = PS_TCHRES; /* switch to other cs: tch switch-type with ps request */
OUT_PRIEVT->add_dat = 0; /* switch type: tch switch-type */
}
SYS_WORK->tsk_id = TASKMNG; /* send switch indiction message to MN*/
OUT_PRIEVT->evt_cod = ERT;
OUT_PRIEVT->pri_cod = PSTCHASS;
OUT_PRIEVT->dmy3 = (U1)IN_DLDEVT->dl_id;
m_excreq( (WORD*)&SYS_WORK->tsk_id );
txstp_req(TCH1); /* tx stop(tch1) */
tch_re = 0;
switch ( Rt_sts ) /* if receive switch indiction message ,pre-switch stop */
{
case ST_TCH_ACT :
if ( Rt_tim & TR304ON ) /* if timer TR304 startup */
{
rt_tm_stop( TR304ON );
tch_re |= BIT1; /* tch switch*/
}
if ( Rt_tim & TR305ON )
{
rt_tm_stop( TR305ON );
tch_re |= BIT2; /* recall switch */
}
if ( tch_re )
{
set_up_b((U1 *)SYS_WORK->out_evt, 0, sizeof(SYS_WORK->out_evt));
SYS_WORK->tsk_id = TASKMNG; /* send switch release to MN */
OUT_PRIEVT->evt_cod = ERT;
OUT_PRIEVT->pri_cod = PSTCHACA;
OUT_PRIEVT->add_dat = tch_re;
OUT_PRIEVT->dmy3 = (U1)IN_DLDEVT->dl_id;
m_excreq( (WORD*)&SYS_WORK->tsk_id );
}
break;
case ST_TCH_REQ :
case ST_TCH_RREQ:
rt_tm_stop( TR301ON );
break;
}
switch ( Tchre_id )
{
case PS_TCHRES : /* tch switch-type */
case CS_TCHRES :
if ( Rt_rcsid[6] ) /* set the current radio infomation */
{
move_up_b((U1*)Rt_radinf.cs_id, Rt_rcsid, 6);
move_up_b(SYS_CSID_P, Rt_rcsid, 6);
}
if ( cmp_up_b((U1*) Rt_radinf.cs_id, (U1*)Rt_radbak.cs_id, 6 ))
{
csid_set_req( (U1*)Rt_radinf.cs_id );
}
SYS_SLT_NUM = Rt_radinf.slt_num;
SYS_CAR_NUM = Rt_radinf.car_num;
abs_slot = Rt_radinf.abs_slot;
rssi_req( (U1)(Rt_radinf.car_num-1), Rt_slot, (U1)(abs_slot+1) );
/* Uwave dector */
Rt_sts = ST_TCH_UREQ;
break;
case PS_RESHND : /* recall type */
case CS_HNDLCH :
rt_tm_start( TR105ON );
rt_tm_start( TR306ON );
Rt_mntcnt = 0;
Rt_gain = GAIN_M;
move_up_b(Rt_enc, enc_set, 2);
cch_m_req( CCH_HO, SYS_FREQ, SYS_HO_RSSI, Rt_gain, OFF );
/* camp cs list */
Rt_sts = ST_CS_REQ;
break;
}
return (3);
}
U1 rt_tch_switch_rej(void)
{
U1 *input_ptr =(U1*) &IN_MSGDAT->dat[2];
U1 *output_ptr = 0;
if(IN_MSGDAT->dat[0] != RT_ID)
{
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
return(0);
}
OUT_PRIEVT->buf_adr = m_hntbuf( );
OUT_PRIEVT->inf_adr = OUT_PRIEVT->buf_adr+MSB_S +2;
output_ptr = OUT_PRIEVT->inf_adr;
OUT_PRIEVT->inf_len = 0;
if(*input_ptr == rt_switch_req_rej_info[0].element_id)
{
if(rt_switch_req_rej_info[0].type == TYP2)
{
move_up_b(output_ptr,input_ptr,rt_switch_req_rej_info[0].len);
OUT_PRIEVT->inf_len = rt_switch_req_rej_info[0].len;
}
else if(rt_switch_req_rej_info[0].type == TYP1)
{
move_up_b(output_ptr,input_ptr,(U2)(input_ptr[1]+2));
OUT_PRIEVT->inf_len = input_ptr[1] +2;
}
if(*input_ptr == CAUSE)
if(!rt_check_cause(input_ptr))
{
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
m_frebuf(OUT_PRIEVT->buf_adr);
return (0);
}
}
else
{
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
m_frebuf(OUT_PRIEVT->buf_adr);
return (0);
}
// if(*input_ptr != CAUSE)
// {
// m_frebuf((U1 *)IN_DLDEVT->msg_adr);
// m_frebuf(OUT_PRIEVT->buf_adr);
// return (0);
// }
// else
// {
// if(*input_ptr == CAUSE)
// if(!rt_check_cause(input_ptr))
// {
// m_frebuf((U1 *)IN_DLDEVT->msg_adr);
// m_frebuf(OUT_PRIEVT->buf_adr);
// return(0);
// }
// move_up_b(output_ptr,input_ptr,2);
// OUT_PRIEVT->inf_len = 2;
// }
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
m_frebuf(OUT_PRIEVT->buf_adr);
rt_tm_stop( TR301ON );
rt_tm_start( TR304ON );
SYS_WORK->tsk_id = TASKMNG;
OUT_PRIEVT->evt_cod = ERT;
OUT_PRIEVT->pri_cod = PSTCHARE;
OUT_PRIEVT->add_dat = BIT8;
OUT_PRIEVT->dmy3 = (U1)IN_DLDEVT->dl_id;
m_excreq( (WORD*)&SYS_WORK->tsk_id );
Tchrrcnt = 0;
//Rt_sts = ST_TCH_ACT;
Rt_sts = (U1)rt_state_table->state;
return (0);
}
U1 rt_txpwr(void)
{
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
return (0);
}
U1 rt_voxctl(void)
{
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
return (0);
}
U1 rt_opt(void)
{
if (( IN_MSGDAT->dat[1] < OPTMIN ) || ( IN_MSGDAT->dat[1] > OPTMAX ))
{
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
return (0);
}
SYS_WORK->tsk_id = TASKMNG;
OUT_PRIEVT->evt_cod = ERT;
OUT_PRIEVT->pri_cod = PSTCHARE;
OUT_PRIEVT->buf_adr = (U1 *)IN_DLDEVT->msg_adr;
OUT_PRIEVT->inf_len = (U2)(IN_MSGDAT->len-2);
OUT_PRIEVT->inf_adr = (U1*)IN_MSGDAT->dat;
m_excreq( (WORD*)&SYS_WORK->tsk_id );
return (0);
}
U1 rt_zone(void)
{
U1 dat,
len;
if (( Sys_rtfunc[7] & BIT1 ) == 0x00 )
{
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
return (0);
}
dat = 0;
len = 0;
if ( IN_MSGDAT->dat[2] == AREA_INFO )
{
dat |= BIT1;
len += 8;
if(((IN_MSGDAT->dat[3] < 0x2c) || ( IN_MSGDAT->dat[3] > 0x72))
||((IN_MSGDAT->dat[4] < 0x2c) || ( IN_MSGDAT->dat[4] > 0x72))
||((IN_MSGDAT->dat[5] < 0x2c) || ( IN_MSGDAT->dat[5] > 0x72))
||((IN_MSGDAT->dat[6] < 0x2c) || ( IN_MSGDAT->dat[6] > 0x72))
||((IN_MSGDAT->dat[7] < 0x2c) || ( IN_MSGDAT->dat[7] > 0x72))
||(IN_MSGDAT->dat[8] > 0xF0))
{
//m_frebuf(OUT_PRIEVT->buf_adr);
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
return (0);
}
}
if ( IN_MSGDAT->dat[2+len] == BROADCAST_INFO )
{
dat |= BIT2;
}
else
{
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
return (0);
}
SYS_WORK->tsk_id = TASKMNG;
OUT_PRIEVT->evt_cod = ERT;
OUT_PRIEVT->pri_cod = PSTCHARE;
OUT_PRIEVT->buf_adr = (U1 *)IN_DLDEVT->msg_adr;
OUT_PRIEVT->inf_len = (U2)(IN_MSGDAT->len-2);
OUT_PRIEVT->inf_adr = (U1*)&IN_MSGDAT->dat[2];
OUT_PRIEVT->add_dat = dat;
m_excreq( (WORD*)&SYS_WORK->tsk_id );
return (0);
}
U1 rt_addas(void)
{
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
return (0);
}
U1 rt_addasr(void)
{
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
return (0);
}
U1 rt_add_channel_req_ind(void)
{
U2 chk;
U1 *input_ptr = (U1*)&IN_MSGDAT->dat[2];
U1 *output_ptr = 0;
if ( Sys_ccsinf[19] >= 0x04 )
{
if(IN_MSGDAT->dat[0] != RT_ID)
{
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
return(0);
}
OUT_PRIEVT->buf_adr = m_hntbuf( );
OUT_PRIEVT->inf_adr = OUT_PRIEVT->buf_adr+MSB_S +2;
output_ptr = OUT_PRIEVT->inf_adr;
OUT_PRIEVT->inf_len = 0;
if(*input_ptr == rt_add_channel_req_ind_info.element_id)
{
if(rt_add_channel_req_ind_info.type == TYP2)
{
move_up_b(output_ptr,input_ptr,rt_add_channel_req_ind_info.len);
OUT_PRIEVT->inf_len = rt_add_channel_req_ind_info.len;
}
else if(rt_add_channel_req_ind_info.type == TYP1)
{
move_up_b(output_ptr,input_ptr,(U2)(input_ptr[1]+2));
OUT_PRIEVT->inf_len = input_ptr[1] +2;
}
}
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
if ( Cc_sts == 0 )
{
SYS_WORK->tsk_id = TASKRT;
OUT_PRIEVT->evt_cod = ERT;
OUT_PRIEVT->pri_cod = PRADDRQIR;
for ( chk = OUT_PRIEVT->inf_len; chk > 0; chk-- )
{
OUT_PRIEVT->inf_adr[chk+1] = OUT_PRIEVT->inf_adr[chk-1];
}
OUT_PRIEVT->inf_adr[0] = CAUSE;
OUT_PRIEVT->inf_adr[1] = 0x58;
OUT_PRIEVT->inf_len += 2;
m_excreq( (WORD*)&SYS_WORK->tsk_id );
}
else
{
m_frebuf(OUT_PRIEVT->buf_adr);
}
}
else
{
m_frebuf((U1 *)IN_DLDEVT->msg_adr);
}
return (0);
}
#ifdef __cplusplus
}
#endif
#undef __RTSCHI_C_
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -