📄 caproc.c
字号:
t_suspend(0L);
}
}
/*创建ECMG任务,20050726fupoxing*/
if(g_ecmg_stream_status_list[2].streamcount)
{
rc = t_create("THIECM", ECMG_PRI, 4096, 4096,T_LOCAL, &g_tid_ecmg2);
if(rc)
{
Display(" Task %s create error ! ","ECMG2");
t_suspend(0L);
}
/*启动任务用于连接ECMG*/
rc = t_start(g_tid_ecmg2, T_ISR|T_NOPREEMPT|T_SUPV, tk_ecmgMgr2, 0);
if(rc)
{
Display(" Task %s start error !", "ECMG2");
t_suspend(0L);
}
}
if(g_ecmg_stream_status_list[0].streamcount)
{
rc = t_create("EMMG", EMMG_PRI, 4096, EMMG_STACK_LEN,T_LOCAL, &g_tid_emmg);
if(rc)
{
Display(" Task %s create error ! ","EMMG");
t_suspend(0L);
}
/*启动任务用于接收EMMG的连接*/
rc = t_start(g_tid_emmg, T_ISR|T_NOPREEMPT|T_SUPV, tk_emmgMgr, 0);
if(rc)
{
Display(" Task %s start error !", "EMMG");
t_suspend(0L);
}
}
if(g_ecmg_stream_status_list[1].streamcount)
{
rc = t_create("EMMG1", EMMG_PRI, 4096,EMMG_STACK_LEN,T_LOCAL, &g_tid_emmg1);
if(rc)
{
Display(" Task %s create error ! ","EMMG1");
t_suspend(0L);
}
/*启动任务用于接收EMMG的连接*/
rc = t_start(g_tid_emmg1, T_ISR|T_NOPREEMPT|T_SUPV, tk_emmgMgr1, 0);
if(rc)
{
Display(" Task %s start error !", "EMMG1");
t_suspend(0L);
}
}
if(g_ecmg_stream_status_list[2].streamcount)
{
rc = t_create("EMMG2", EMMG_PRI, 4096,EMMG_STACK_LEN,T_LOCAL, &g_tid_emmg2);
if(rc)
{
Display(" Task %s create error ! ","EMMG2");
t_suspend(0L);
}
/*启动任务用于接收EMMG的连接*/
rc = t_start(g_tid_emmg2, T_ISR|T_NOPREEMPT|T_SUPV, tk_emmgMgr2, 0);
if(rc)
{
Display(" Task %s start error !", "EMMG2");
t_suspend(0L);
}
}
my_Delay(10000);
if(g_ecmg_stream_status_list[0].streamcount || g_ecmg_stream_status_list[1].streamcount
|| g_ecmg_stream_status_list[2].streamcount)
{
rc = t_create("TKCWINT", 232, 4096, 4096,T_LOCAL, &g_CW_TkInt);
if(rc)
{
Display(" Task %s create error ! ","ECMG2");
t_suspend(0L);
}
/*启动任务用于连接ECMG*/
rc = t_start(g_CW_TkInt, T_ISR|T_NOPREEMPT|T_SUPV, tk_CWInt, 0);
if(rc)
{
Display(" Task %s start error !", "TKCWINT");
t_suspend(0L);
}
SendQueue("CWINT",Msg);
my_Delay(500);
}
}
if(!(((g_has_valid_ca_config)&&(g_ecmg_connected[0]==0))||
((g_has_valid_ca1_config)&&(g_ecmg_connected[1]==0))||
((g_has_valid_ca2_config)&&(g_ecmg_connected[2]==0))))
{
/*根据加扰设置填写CWG存储器*/
if(g_has_valid_ca_config||g_has_valid_ca1_config||g_has_valid_ca2_config)
{
bSetCA=1;
bClearCA=0;
ca_write_simucrypt_map();
}
}
else if(g_has_valid_ca_config||g_has_valid_ca1_config||g_has_valid_ca2_config)
{
bSetCA=0;
bClearCA=1;
ca_Clear_simucrypt_map();
}
CreateQueue("CAST",&g_qid_ca);
for(;;)
{
/*等待网管重新设置,需要重启任务*/
if(ReceiveQueue("CAST",Q_WAIT,10,Msg)==ERR_TIMEOUT) /* get the new config of CA from NM */
{
if(((g_has_valid_ca_config)&&(g_ecmg_connected[0]==0))||
((g_has_valid_ca1_config)&&(g_ecmg_connected[1]==0))||
((g_has_valid_ca2_config)&&(g_ecmg_connected[2]==0)))
{
/*根据加扰设置填写CWG存储器*/
if(bClearCA==0)
{
ca_Clear_simucrypt_map();
bSetCA=0;
bClearCA=1;
}
}
else
{
if(g_has_valid_ca_config||g_has_valid_ca1_config||g_has_valid_ca2_config)
{
if(bSetCA==0)
{
ca_write_simucrypt_map();
bClearCA=0;
bSetCA=1;
}
}
}
continue;
}
/* ca_Clear_simucrypt_map();
bClearCA=1;
bSetCA=0; */
/* g_IsResetStatue = 1;*/
/*------------------------------------------------------------------*/
/* build stream list for ecmg task */
/*------------------------------------------------------------------*/
/*初始化流列表*/
BuildStreamList();
/*------------------------------------------------------------------*/
/* update CAT section with emm pid */
/*------------------------------------------------------------------*/
/*在CAT表中加入EMM信息*/
UpdateCATSectionWithEMM();
/*------------------------------------------------------------------*/
/* update PMT with ecm pid */
/*------------------------------------------------------------------*/
/*在PMT表中加入ECM信息*/
update_si_with_ca();
/*------------------------------------------------------------------*/
/* no program need encrption, suspend ecmg&emmg task */
/*------------------------------------------------------------------*/
/*added by xu*/
ECMMsg[0] = 2;
if(g_ecmg_stream_status_list[0].streamcount==0)
{
if(g_tid_ecmg)
{
SendQueue("QONE",ECMMsg);
my_Delay(1000);/*by xu*/
t_suspend(g_tid_ecmg);
}
}
else
{/*需要创建ECMG任务或对任务重启*/
if(g_tid_ecmg==0) /* task ecmg has not been created, create it */
{
rc = t_create("FIRECM", ECMG_PRI, 4096, 4096,T_LOCAL, &g_tid_ecmg);
if(rc)
{
Display(" Task %s create error ! ","ECMG");
t_suspend(0L);
}
rc = t_start(g_tid_ecmg, T_ISR|T_NOPREEMPT, tk_ecmgMgr, 0);
if(rc)
{
Display(" Task %s start error !", "ECMG");
t_suspend(0L);
}
}
else/* need to inform task ecmg to apply the new config */
{
if(Msg[0])
{
caSendLog(LOGTYPE_NORMAL,"ecmg task restart!\n");
t_suspend(g_tid_ecmg);
t_restart(g_tid_ecmg,0);
}
}
}
if(g_ecmg_stream_status_list[1].streamcount==0)
{
if(g_tid_ecmg1)
{
SendQueue("QSEC",ECMMsg);
my_Delay(1000);
t_suspend(g_tid_ecmg1);
}
}else
{/*需要创建ECMG任务或对任务重启*/
if(g_tid_ecmg1==0) /* task ecmg has not been created, create it */
{
rc = t_create("SECECM", ECMG_PRI, 4096, 4096,T_LOCAL, &g_tid_ecmg1);
if(rc)
{
Display(" Task %s create error ! ","ECMG1");
t_suspend(0L);
}
rc = t_start(g_tid_ecmg1, T_ISR|T_NOPREEMPT, tk_ecmgMgr1, 0);
if(rc)
{
Display(" Task %s start error !", "ECMG1");
t_suspend(0L);
}
}
else/* need to inform task ecmg to apply the new config */
{
if(Msg[0])
{
caSendLog(LOGTYPE_NORMAL,"ecmg1 task restart!\n");
t_suspend(g_tid_ecmg1);
t_restart(g_tid_ecmg1,0);
}
}
}
if(g_ecmg_stream_status_list[2].streamcount==0)
{
if(g_tid_ecmg2)
{
SendQueue("QTHI",ECMMsg);
my_Delay(1000); /*by xu*/
t_suspend(g_tid_ecmg2);
}
}else
{/*需要创建ECMG任务或对任务重启*/
if(g_tid_ecmg2==0) /* task ecmg has not been created, create it */
{
rc = t_create("THIECM", ECMG_PRI, 4096, 4096,T_LOCAL, &g_tid_ecmg2);
if(rc)
{
Display(" Task %s create error ! ","ECMG2");
t_suspend(0L);
}
rc = t_start(g_tid_ecmg2, T_ISR|T_NOPREEMPT, tk_ecmgMgr2, 0);
if(rc)
{
Display(" Task %s start error !", "ECMG2");
t_suspend(0L);
}
}
else/* need to inform task ecmg to apply the new config */
{
if(Msg[0])
{
caSendLog(LOGTYPE_NORMAL,"ecmg2 task restart!\n");
t_suspend(g_tid_ecmg2);
t_restart(g_tid_ecmg2,0);
}
}
}
if(g_ecmg_stream_status_list[0].streamcount)
{
if(g_tid_emmg==0) /* task emmg has not been created, create it */
{/*如未创建EMMG任务,则立即创建*/
rc = t_create("EMMG", EMMG_PRI,4096, EMMG_STACK_LEN,T_LOCAL, &g_tid_emmg);
if(rc)
{
Display(" Task %s create error ! ","EMMG");
t_suspend(0L);
}
rc = t_start(g_tid_emmg, T_ISR|T_NOPREEMPT, tk_emmgMgr, 0);
if(rc)
{
Display(" Task %s start error !", "EMMG");
t_suspend(0L);
}
}
else /* need to inform task emmg to apply the new config */
{
/**if(Msg[1] || g_emmg_suspend)*//*by xu*/
if((Msg[1]&0x01)||g_emmg_suspend)
{
g_Emmg_connected[0] = 0;
my_Delay(1000);
t_suspend(g_tid_emmg);
t_restart(g_tid_emmg,0);
}
}
}
if(g_ecmg_stream_status_list[1].streamcount)
{
if(g_tid_emmg1==0) /* task emmg has not been created, create it */
{/*如未创建EMMG任务,则立即创建*/
rc = t_create("EMMG1",EMMG_PRI, 4096, EMMG_STACK_LEN,T_LOCAL, &g_tid_emmg1);
if(rc)
{
Display(" Task %s create error ! ","EMMG1");
t_suspend(0L);
}
rc = t_start(g_tid_emmg1, T_ISR|T_NOPREEMPT, tk_emmgMgr1, 0);
if(rc)
{
Display(" Task %s start error !", "EMMG1");
t_suspend(0L);
}
}
else /* need to inform task emmg to apply the new config */
{
/*if(Msg[1] || g_emmg1_suspend)*/ /*by xu*/
if((Msg[1]&0x02)||g_emmg_suspend)
{
g_Emmg_connected[1] = 0;
my_Delay(1000);
t_suspend(g_tid_emmg1);
t_restart(g_tid_emmg1,0);
}
}
}
if(g_ecmg_stream_status_list[2].streamcount)
{
if(g_tid_emmg2==0) /* task emmg has not been created, create it */
{/*如未创建EMMG任务,则立即创建*/
rc = t_create("EMMG2", EMMG_PRI, 4096, EMMG_STACK_LEN,T_LOCAL, &g_tid_emmg2);
if(rc)
{
Display(" Task %s create error ! ","EMMG2");
t_suspend(0L);
}
rc = t_start(g_tid_emmg2, T_ISR|T_NOPREEMPT, tk_emmgMgr2, 0);
if(rc)
{
Display(" Task %s start error !", "EMMG2");
t_suspend(0L);
}
}
else /* need to inform task emmg to apply the new config */
{
/*if(Msg[1] || g_emmg2_suspend)*/ /*by xu*/
if((Msg[1]&0x04)||g_emmg_suspend)
{
g_Emmg_connected[2] = 0;
my_Delay(1000);
t_suspend(g_tid_emmg2);
t_restart(g_tid_emmg2,0);
}
}
}
my_Delay(10000);
/*------------------------------------------------------------------*/
/* write simucrypt map table */
/*------------------------------------------------------------------*/
if(g_ecmg_stream_status_list[0].streamcount || g_ecmg_stream_status_list[1].streamcount
|| g_ecmg_stream_status_list[2].streamcount)
{
if(g_CW_TkInt == 0)
{
rc = t_create("TKCWINT", 232, 4096, 4096,T_LOCAL, &g_CW_TkInt);
if(rc)
{
Display(" Task %s create error ! ","TKCWINT");
t_suspend(0L);
}
/*启动任务用于连接ECMG*/
rc = t_start(g_CW_TkInt, T_ISR|T_NOPREEMPT|T_SUPV, tk_CWInt, 0);
if(rc)
{
Display(" Task %s start error !", "TKCWINT");
t_suspend(0L);
}
SendQueue("CWINT",Msg);
}else
{
if(Msg[0])
{
caSendLog(LOGTYPE_NORMAL,"CWInt task restart!\n");
t_suspend(g_CW_TkInt);
t_restart(g_CW_TkInt,0);
SendQueue("CWINT",Msg);
}
}
}
else
{
if(g_CW_TkInt)
t_suspend(g_CW_TkInt);
}
if(!(((g_has_valid_ca_config)&&(g_ecmg_connected[0]==0))||
((g_has_valid_ca1_config)&&(g_ecmg_connected[1]==0))||
((g_has_valid_ca2_config)&&(g_ecmg_connected[2]==0))))
{
/*根据加扰设置填写CWG存储器*/
if(g_has_valid_ca_config||g_has_valid_ca1_config||g_has_valid_ca2_config)
{
bSetCA=1;
bClearCA=0;
ca_write_simucrypt_map();
}
}
else if(g_has_valid_ca_config||g_has_valid_ca1_config||g_has_valid_ca2_config)
{
bSetCA=0;
bClearCA=1;
ca_Clear_simucrypt_map();
}
}
}
void tk_caReStart(void)
{
if(!(((g_has_valid_ca_config)&&(g_ecmg_connected[0]==0))||
((g_has_valid_ca1_config)&&(g_ecmg_connected[1]==0))||
((g_has_valid_ca2_config)&&(g_ecmg_connected[2]==0))))
{
/*根据加扰设置填写CWG存储器*/
if(g_has_valid_ca_config||g_has_valid_ca1_config||g_has_valid_ca2_config)
{
ca_write_simucrypt_map();
}
else
{
ca_Clear_simucrypt_map();
}
}
else
{
ca_Clear_simucrypt_map();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -