|
|
@@ -218,73 +218,19 @@ int net_debug_s_exit(void)
|
|
|
// TODO: 需要确认是否需要重新初始化
|
|
|
int net_debug_init(void)
|
|
|
{
|
|
|
-#ifdef LINUX_KERNEL_APP
|
|
|
-
|
|
|
- struct sched_param sp;
|
|
|
- pid_t pid;
|
|
|
-
|
|
|
-#if 0
|
|
|
- // 如果已经初始化,退出
|
|
|
- if(g_ts_debug_send)
|
|
|
- {
|
|
|
- return 0;
|
|
|
- }
|
|
|
-
|
|
|
+ int ret;
|
|
|
+ pthread_attr_t attr;
|
|
|
|
|
|
- // 运行应用调试线程
|
|
|
- //g_ts_debug_send = kthread_run(_net_debug_thread_send,NULL,"net_debug_send");
|
|
|
- pid = kernel_thread(_net_debug_thread_send, NULL,CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD);
|
|
|
- g_ts_debug_send = find_task_by_vpid(pid);
|
|
|
- if(IS_ERR(g_ts_debug_send))
|
|
|
- {
|
|
|
- printk("ts=%p\r\n",g_ts_debug_send);
|
|
|
- g_ts_debug_send = NULL;
|
|
|
- return -1;
|
|
|
- }
|
|
|
- g_net_debug_thread_send_pid = pid;
|
|
|
- memset(&sp,0,sizeof(sp));
|
|
|
- sp.sched_priority = 8;
|
|
|
- sched_setscheduler(g_ts_debug_send,SCHED_FIFO,&sp);
|
|
|
- // 设置进程名字
|
|
|
- set_task_comm(g_ts_debug_send, "net_debug_send");
|
|
|
-#endif
|
|
|
-
|
|
|
- // 如果已经初始化,退出
|
|
|
- if(g_ts_debug_recv)
|
|
|
- {
|
|
|
- return 0;
|
|
|
- }
|
|
|
- //g_ts_debug_recv = kthread_run(_net_debug_thread_recv,NULL,"net_debug_recv");
|
|
|
- pid = kernel_thread(_net_debug_thread_recv, NULL,CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD);
|
|
|
- g_ts_debug_recv = find_task_by_vpid(pid);
|
|
|
- if(IS_ERR(g_ts_debug_recv))
|
|
|
- {
|
|
|
- printk("ts=%p\r\n",g_ts_debug_recv);
|
|
|
- g_ts_debug_recv = NULL;
|
|
|
- return -1;
|
|
|
- }
|
|
|
- g_net_debug_thread_recv_pid = pid;
|
|
|
+ //attr.__schedpolicy = SCHED_FIFO;
|
|
|
+ //attr.__schedparam.sched_priority =8;
|
|
|
|
|
|
// 设置调度策略和优先级
|
|
|
- memset(&sp,0,sizeof(sp));
|
|
|
- sp.sched_priority = 8;
|
|
|
- sched_setscheduler(g_ts_debug_recv,SCHED_FIFO,&sp);
|
|
|
- // 设置进程名字
|
|
|
- set_task_comm(g_ts_debug_recv, "net_debug_recv");
|
|
|
-#else
|
|
|
- int ret;
|
|
|
- pthread_attr_t attr;
|
|
|
-
|
|
|
- //attr.__schedpolicy = SCHED_FIFO;
|
|
|
- //attr.__schedparam.sched_priority =8;
|
|
|
-
|
|
|
- // 设置调度策略和优先级
|
|
|
- pthread_attr_init(&attr);
|
|
|
- pthread_attr_setschedpolicy(&attr, SCHED_FIFO); //调度
|
|
|
- struct sched_param s_parm;
|
|
|
- //s_parm.sched_priority = sched_get_priority_max(SCHED_FIFO);
|
|
|
- s_parm.sched_priority = 8;
|
|
|
- pthread_attr_setschedparam(&attr, &s_parm); //优先级
|
|
|
+ pthread_attr_init(&attr);
|
|
|
+ pthread_attr_setschedpolicy(&attr, SCHED_FIFO); //调度
|
|
|
+ struct sched_param s_parm;
|
|
|
+ //s_parm.sched_priority = sched_get_priority_max(SCHED_FIFO);
|
|
|
+ s_parm.sched_priority = 8;
|
|
|
+ pthread_attr_setschedparam(&attr, &s_parm); //优先级
|
|
|
|
|
|
ret = pthread_create(&g_ts_debug_recv, &attr, (void *)_net_debug_thread_recv, NULL);
|
|
|
if(!ret)
|
|
|
@@ -293,8 +239,6 @@ int net_debug_init(void)
|
|
|
//g_ts_rcd = 0;
|
|
|
return ret;
|
|
|
}
|
|
|
-
|
|
|
-#endif
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -330,19 +274,6 @@ int net_debug_exit(void)
|
|
|
#else
|
|
|
int net_debug_exit(void)
|
|
|
{
|
|
|
- #if 0
|
|
|
- int status;
|
|
|
- if(g_ts_debug_send != NULL)
|
|
|
- {
|
|
|
- up(&g_print_sem);
|
|
|
- g_net_debug_send_exit_flag = 1;
|
|
|
-
|
|
|
- sys_wait4(g_net_debug_thread_send_pid, (int __user *)&status, 0, NULL);
|
|
|
-
|
|
|
- g_ts_debug_send = NULL;
|
|
|
-
|
|
|
- }
|
|
|
- #endif
|
|
|
if(g_ts_debug_recv)
|
|
|
{
|
|
|
g_net_debug_recv_exit_flag = 1;
|
|
|
@@ -434,6 +365,8 @@ N:
|
|
|
P:61850信息打印\r\n \
|
|
|
Q:生成菜单显示文件\r\n \
|
|
|
R:生成icd文件\r\n \
|
|
|
+r:查看实时线程状态\r\n \
|
|
|
+s:复位实时线程状态\r\n \
|
|
|
其它:关闭所有监视信息\r\n \
|
|
|
\r\n>:";
|
|
|
#endif
|
|
|
@@ -457,6 +390,9 @@ int _net_debug_get_chn(void)
|
|
|
|
|
|
return -1;
|
|
|
}
|
|
|
+
|
|
|
+extern int dt_cmd_rt(void);
|
|
|
+extern int dt_cmd_rt_reset(void);
|
|
|
void net_debug_app(void)
|
|
|
{
|
|
|
u8 ch;
|
|
|
@@ -706,6 +642,20 @@ void net_debug_app(void)
|
|
|
rt_printf("\r\n/app/data/lcd_menu.csv 菜单定义文件已生成\r\n");
|
|
|
}
|
|
|
break;
|
|
|
+
|
|
|
+ case 'r':
|
|
|
+ {
|
|
|
+ g_print_to_net = 1;
|
|
|
+ dt_cmd_rt();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 's':
|
|
|
+ {
|
|
|
+ g_print_to_net = 1;
|
|
|
+ dt_cmd_rt_reset();
|
|
|
+ }
|
|
|
+ break;
|
|
|
#ifdef CAN_SLAVE_BOARD
|
|
|
|
|
|
case 'R':
|