ソースを参照

Feat: 增加实时线程监测并调整部分线程参数

juni 1 年間 前
親
コミット
b4221b5c44

+ 1 - 1
app_public/fuxi_public/bsp_share/bsp_ccu.c

@@ -62,7 +62,7 @@ int ccu_init(void)
     }
     else
     {
-        printf ("map Successfull!\n");
+        printf ("CCU map Successfull!\n");
     }
     fflush(stdout);
 

+ 1 - 1
app_public/fuxi_public/bsp_share/bsp_ustimer.c

@@ -69,7 +69,7 @@ int bsp_ustimer_init(void)
     }
     else
     {
-        printf ("map Successfull!\n");
+        printf ("BSP ustimer map Successfull!\n");
     }
     fflush(stdout);
 

+ 4 - 4
app_public/fuxi_public/bsp_share/main.c → app_public/fuxi_public/bsp_share/main_demo.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 版权所有:    @copyright (C) 2024-2034 HaiYang Technology Corp. All rights reserved.
-文件名称:    main.c
+文件名称:    main_demo.c
 文件版本:    01.01
 创建作者:     zhaoyang
 创建日期:    2025-07-28
@@ -16,7 +16,7 @@
 #include <pthread.h>
 #include <sched.h>
 #include <sys/resource.h>
-#include "ustimer.h"
+#include "bsp_ustimer.h"
 #include <sys/random.h> // 生成随机数,用于测试
 #include "bsp_share.h"
 #include <sys/mman.h>
@@ -86,8 +86,8 @@ done:
     return NULL;
 }
 
-
-int main(int argc, char *argv[]){
+/* we test used here */
+int main_demo(int argc, char *argv[]){
     pthread_attr_t attr;
     struct sched_param param;
     pthread_t thread;

+ 3 - 41
app_public/fuxi_public/fuxi_bsp/source/pit.c

@@ -31,6 +31,7 @@ FN_PIT_CALLBACK g_pit_callback_156us;
 
 struct rt_stat g_stat_156us;
 struct rt_stat g_stat_5ms;
+extern struct rt_stat g_stat_periodus_5ms;
 
 void pit_156us_isr(void);
 void pit_5ms_isr(void);
@@ -53,48 +54,7 @@ int pit_500us_isr(int irq, void *data);
 */
 int pit_init(void)
 {
-#if 0
-	//PIT3,采样中断
-	// 允许ADC时钟(PIT3 CD35)
-	MCF_PMM_PPMCR0 = CFG_PIT_CD_BEGIN + CFG_PIT_SAMPLE;
-	
-	//设置控制寄存器
-	MCF_PIT3_PCSR =   0
-					| MCF_PIT_PCSR_EN		//允许
-					| MCF_PIT_PCSR_RLD		//自动重装
-					| MCF_PIT_PCSR_PIF		//清除中断标志
-					| MCF_PIT_PCSR_PIE		//允许中断
-//					| MCF_PIT_PCSR_OVW		//允许重写
-					| MCF_PIT_PCSR_PRE(0);	//分频值为1,使用CFG_SYSTEM_CLOCK_KHZ/2频率。
-	
-	//设置定时周期。
-	MCF_PIT3_PMR = (unsigned short)(PIT_PERIOD_156US - 1); //一分频下必须再减一(十六分频下不需要)
-	
-	
-	// 申请实时中断
-	rt_request_irq(CFG_PIT_VECTOR_BEGIN+CFG_PIT_SAMPLE,CFG_INT_LEVEL_PIT,pit_156us_isr,"pit_156us_isr");
-	
-	//PIT2,5MS中断
-	// 允许ADC时钟(PIT2 CD34)
-	MCF_PMM_PPMCR0 = CFG_PIT_CD_BEGIN + CFG_PIT_5MS;
-	
-	//设置控制寄存器
-	MCF_PIT2_PCSR =   0
-					| MCF_PIT_PCSR_EN		//允许
-					| MCF_PIT_PCSR_RLD		//自动重装
-					| MCF_PIT_PCSR_PIF		//清除中断标志
-					| MCF_PIT_PCSR_PIE		//允许中断
-	//				| MCF_PIT_PCSR_OVW		//允许重写
-					| MCF_PIT_PCSR_PRE(4);	//分频值为16,使用CFG_SYSTEM_CLOCK_KHZ/2/16频率。
-	
-	//设置定时周期。
-	MCF_PIT2_PMR = (unsigned short)(PIT_PERIOD_5MS);
-	
-	// 申请实时中断
-	rt_request_irq(CFG_PIT_VECTOR_BEGIN+CFG_PIT_5MS,CFG_INT_LEVEL_5MS,pit_5ms_isr,"pit_5ms_isr");
-
 	pit_stat_reset();
-#endif
 	return 0;	
 }
 
@@ -257,6 +217,7 @@ int pit_stat_reset(void)
 {
 	rt_stat_init(&g_stat_156us,"pit_156us_isr(8ns)");
 	rt_stat_init(&g_stat_5ms,"pit_5ms_isr(128ns)");
+	rt_stat_init(&g_stat_periodus_5ms, "pit_5ms_priod(1us)");
 
 	return 0;
 }
@@ -268,6 +229,7 @@ int pit_stat_printf(void)
 	
 	rt_stat_printf(&g_stat_156us);
 	rt_stat_printf(&g_stat_5ms);
+	rt_stat_printf(&g_stat_periodus_5ms);
 
 	return 0;
 }

+ 2 - 2
app_public/fuxi_public/fuxi_bsp/source/shm.c

@@ -162,9 +162,9 @@ static int co_open(struct dev_co *co, char *name, int blk)
     int fd_shm1;
 	uint8_t *shm0 = NULL;
 	uint8_t *shm1 = NULL;
-
+#ifdef CO_DEBUG
     printf("open co dev %s blk=%d\n", name, blk);
-
+#endif
 	if(0 == blk) {
 		fd_shm0 = open("/dev/arv-shmem", O_RDWR);
 		if (!fd_shm0) {

+ 1 - 1
app_public/fuxi_public/rt_lite/include/rt_stat.h

@@ -99,7 +99,7 @@ static inline void rt_stat_printf(struct rt_stat *stat)
 		avg = stat->sum/stat->cnt;
 	}
 
-	printf("%-24s%lu\t%lu\t%lu\t%-16lu%lu\r\n",stat->name,stat->min,stat->max,avg,stat->sum,stat->cnt);
+	rt_printf("%-24s%ld\t%ld\t%ld\t%-016ld%ld\r\n",stat->name,stat->min,stat->max,avg,stat->sum,stat->cnt);
 }
 
 

+ 4 - 4
app_public/fuxi_public/rt_lite/source/rt_console.c

@@ -905,9 +905,9 @@ int dt_cmd_rt(void)
 	dt_cmd_rt_printf_head();
 	rt_printf("name\t\t\tmin\tmax\tavg\tsum\t\tcnt");
 	
-	// sunxi 20200805 pit_stat_printf();
+	pit_stat_printf();
 	
-	// sunxi 20200805 rt_stat_other_printf();
+	rt_stat_other_printf();
 
 	return 0;
 }
@@ -1027,9 +1027,9 @@ int dt_cmd_rt_reset(void)
 	
 	//clock_gettime(CLOCK_REALTIME, &g_ts_rt_reset);
 	
-	// sunxi 20200805 pit_stat_reset();
+	pit_stat_reset();
 	
-	// sunxi 20200805 rt_stat_other_reset();
+	rt_stat_other_reset();
 
 	// sunxi 20200805 adc_stat_reset();
 

+ 1 - 1
app_public/fuxi_public/rt_lite/source/rt_env.c

@@ -59,7 +59,7 @@ int env_init(void)
 
 	// ´ò¿ªÎļþ
 	// pfile = rt_file_open("/tmp/env.dat",O_CREAT|O_RDONLY ,0);
-	pfile = rt_file_open("/app/env.dat",O_RDONLY ,0);
+	pfile = rt_file_open("/tmp/env.dat",O_RDONLY ,0);
 	if(IS_ERR(pfile))
 	{
 	    rt_printf("env data open err!\r\n");  

+ 1 - 1
app_public/fuxi_public/rt_lite/source/rt_printf.c

@@ -110,7 +110,7 @@ void co_printf(const char *fp,const int line)
 	
 	sys_gettime_CP56(&Clock_u);
 
-	sprintf(sDebug,"%02d-%02d-%02d %02d:%02d:%02d:%03d ",Clock_u.time_t.year,Clock_u.time_t.month,
+	sprintf(sDebug,"%04d-%02d-%02d %02d:%02d:%02d:%03d ",Clock_u.time_t.year + 2000,Clock_u.time_t.month,
 		   Clock_u.time_t.day,Clock_u.time_t.hour,Clock_u.time_t.min,Clock_u.time_t.ms/1000,Clock_u.time_t.ms%1000);
 
 	ptr=strrchr(fp,'/');

+ 3 - 3
app_public/fuxi_public/rt_lite/source/rt_socket.c

@@ -666,7 +666,7 @@ int rt_if_ip_get(int index, unsigned char *ip)
 	sock = rt_socket(AF_INET, SOCK_DGRAM, 0);
 	if (sock == RT_SOCKET_ERR)
 	{
-		rt_printf("rt_if_ip_get:: rt_socket::error");
+		rt_printf("rt_if_ip_get:: rt_socket::error\n");
 		return -1;
 	}
 
@@ -756,7 +756,7 @@ int rt_if_mask_get(int index, unsigned char *mask)
 	sock = rt_socket(AF_INET, SOCK_DGRAM, 0);
 	if (sock == RT_SOCKET_ERR)
 	{
-		rt_printf("rt_if_mask_get:: rt_socket::error");
+		rt_printf("rt_if_mask_get:: rt_socket::error\n");
 		return -1;
 	}
 
@@ -1222,7 +1222,7 @@ int rt_if_ip_get2(int eth_id, int index, unsigned char *ip)
 	sock = rt_socket(AF_INET, SOCK_DGRAM, 0);
 	if (sock == RT_SOCKET_ERR)
 	{
-		rt_printf("rt_if_ip_get:: rt_socket::error");
+		rt_printf("rt_if_ip_get2:: rt_socket::error\n");
 		return -1;
 	}
 

+ 1 - 1
dtu/dtu_main_t536/app/IEC101.c

@@ -155,7 +155,7 @@ static void IEC101_Reset(IEC101_DEF *pt101)
 	RS_Recv_Enable(pt101->chnl);
 
 	#ifdef	RCD_STRAN_S
-		rt_printf_time("---------Á´Â·¸´Î»,ÇåÎļþ´«Êä\r\n");
+		rt_printf_time("-> Link Reset, Clear File Cache\r\n");
 		iec_freefile(&pt101->tf);
 		pt101->tf.bTransing=false;
 		pt101->tf.bdatTraned=false;

+ 1 - 1
dtu/dtu_main_t536/app/IEC104.c

@@ -172,7 +172,7 @@ static void IEC104_Reset(IEC104_DEF *pt104)
 	// 104发送缓冲区复位
 	memset(&pt104->TxBuf,0,sizeof(pt104->TxBuf));
 #ifdef	RCD_STRAN_S
-	rt_printf_time("---------104链路复位,清文件传输\r\n");
+	rt_printf_time("-> Link Reset, Clear File Cache\r\n");
 	iec_freefile(&pt104->tf);
 	pt104->tf.bTransing=false;
 	pt104->tf.bdatTraned=false;

+ 2 - 2
dtu/dtu_main_t536/app/IECComm.c

@@ -496,10 +496,10 @@ void IEC_CommInit(void)                     // 
 			{
 				continue;
 			}
-			
+		#ifdef IECCOM_DEBUG
 			rt_printf("UART_CHANNEL[%d]=%d,tRunPara.tUartPara[%d].wProtocol=%d,tRunPara.tUartPara[%d].wBaud=%d tUartPara[%d].wParity=%d\r\n",\
 					i,UART_CHANNEL[i],i,tRunPara.tUartPara[i].wProtocol,i,tRunPara.tUartPara[i].wBaud,i,tRunPara.tUartPara[i].wParity);
-
+		#endif
 			uart_open(UART_CHANNEL[i],tRunPara.tUartPara[i].wBaud,tRunPara.tUartPara[i].wParity);
 
 			RS_Ena_Init(i);

+ 1 - 5
dtu/dtu_main_t536/app/Maintain.c

@@ -3127,13 +3127,9 @@ int Maintain_Manage(u8 *buf, u32 len, u8 *cmd_buf)
 
 		case MS_CLOSE_PORT:
 		{
-			// 关闭端口服务,仅保留6008维护端口
-#ifdef LINUX_KERNEL_APP			
+			// 关闭端口服务,仅保留6008维护端口	
 			net_debug_exit();
-#endif
-#ifndef CPU_FUXI	//不需要使用这个 inetd 服务,现在系统启动后,已经把 inetd 服务启动了			
 			close_inet_port();
-#endif
 
 			rt_printf("网络维护端口关闭.\r\n");
 			

+ 2 - 2
dtu/dtu_main_t536/app/SOE.c

@@ -1483,7 +1483,7 @@ void soe_save(void)
 	u32 us0;
 
 	// Ñ­»·±£´æËùÓмǼ
-	us0 = ustimer_get_origin();
+	us0 = bsp_ustimer_get_origin();
 	head = g_soe_queue.head.n;
 	while(g_soe_queue.tail_eep.n != head && es_save_cnt < SOE_SAVE_BUF_NUM) 
 	{
@@ -1683,7 +1683,7 @@ void soe_save(void)
 	log_str_ext_flush(LOG_YX);
 	log_str_ext_flush(LOG_SOE);
 
-	rt_stat_other_in(5,ustimer_get_duration(us0)/USTIMER_US);
+	rt_stat_other_in(5,bsp_ustimer_get_duration(us0)/USTIMER_US);
 }
 
 

+ 2 - 2
dtu/dtu_main_t536/app/app.c

@@ -31,8 +31,8 @@ struct init_t_1 g_app_init_func[]=
 	{tbl_create_rsc,"tbl_create_rsc",ERR_CODE_RESOURCE_TABLE},
 	{equ_init,"equ_init",ERR_CODE_EQU},
 	{equ_init_later,"equ_init_later",ERR_CODE_EQU},
-#ifndef CPU_FUXI	
-	{adc_init,"adc_init",ERR_CODE_INIT_SOFTWARE},
+#ifdef CPU_FUXI	
+	// {adc_init,"adc_init",ERR_CODE_INIT_SOFTWARE},
 	{pit_init,"pit_init",ERR_CODE_UNKOWN},			//初始化PIT(可编程中断定时器)
 #endif
 	{factor_init,"factor_init",ERR_CODE_FACTOR},

+ 12 - 14
dtu/dtu_main_t536/app/main.c

@@ -17,6 +17,7 @@
 
 
 #include "head.h"
+#include "rt_printf.h"
 #include <sys/prctl.h>
 #include <unistd.h>
 #include <sys/syscall.h>
@@ -88,7 +89,8 @@ static void check_app_folder_recover(void)
 
 int app_main (void *unused)
 {
-	uint32_t us0,us0_sec;
+	int ret;
+	uint64_t us0,us0_sec;
 
 	// 将BKPT管脚设置为中断,防止由于EMC干扰,导致系统复位。
 #ifdef CPU_COLDFIRE	
@@ -102,7 +104,7 @@ int app_main (void *unused)
 	ds18b20_init(); //测温模块初始化,因为测温模块里面有个任务,所以放在这里初始
 #endif
 	SystemInit();
-#if defined (CPU_AM335X) || defined (CPU_FUXI)	
+#ifdef CPU_FUXI
 	SystemInit_finish_flag = true;	
 #endif
 #ifdef CPU_FUXI
@@ -142,11 +144,9 @@ int app_main (void *unused)
 		load_hs_log_rcd(TYPE_DEV_RESTART,true,NULL,log_info,1);
 	}
 
-	if(get_mt_port_proc() != 1)
-	{
-	#ifndef CPU_FUXI	//不需要使用这个 inetd 服务,现在系统启动后,已经把 inetd 服务启动了
+	ret = get_mt_port_proc();
+	if(ret != 1) {
 		close_inet_port();
-	#endif
 	}
 
 #if defined(CPU_AM335X) 
@@ -184,10 +184,10 @@ int app_main (void *unused)
 	}
 #endif
 
-	us0_sec = ustimer_get_origin();
+	us0_sec = bsp_ustimer_get_origin();
 	while(1)
 	{
-//		us0 = ustimer_get_origin();
+		us0 = bsp_ustimer_get_origin();
 //		test_round();
 //		uart_test();
 //		flash_test();
@@ -197,11 +197,9 @@ int app_main (void *unused)
 //		dido_test();
 //		rtc_test();
 #ifdef CPU_FUXI
-		msleep(5000);// 延时1ms
+		msleep(100);
 		// shm_comm_test();
-#endif		
-		us0 = ustimer_get_origin();
-		// rt_printf("main loop start us0:%lu\r\n",us0);
+#endif
 		// 系统的tick秒
 		if(us0 - us0_sec > USTIMER_SEC)
 		{
@@ -257,12 +255,12 @@ int app_main (void *unused)
 		watchdog_feed_mainloop();
 		
 		//统计大循环时间
-		rt_stat_other_in(RT_STAT_BIG_LOOP,ustimer_get_duration(us0)/USTIMER_US);
+		rt_stat_other_in(RT_STAT_BIG_LOOP,bsp_ustimer_get_duration(us0)/USTIMER_US);
 #ifdef LINUX_KERNEL_APP
 		kernel_callback();
 #endif		
 		//us0 = ustimer_get_origin();
-		rt_stat_other_in(7,ustimer_get_duration(us0)/USTIMER_US);
+		rt_stat_other_in(7,bsp_ustimer_get_duration(us0)/USTIMER_US);
 	}
 #ifdef CPU_FUXI
 	watchdog_remove_item(wdt_id_mainloop);

+ 2 - 2
dtu/dtu_main_t536/app/net_104.c

@@ -694,7 +694,7 @@ NET_BEGIN:
 	ret = rt_bind (sk_server, (struct sockaddr *)(&server_addr), sizeof (struct sockaddr));
 	if (ret < 0)
 	{
-		RT_PRINTF_POSITION();
+		// RT_PRINTF_POSITION();
 		rt_socket_close (sk_server);
 		g_ts_104[net] = 0;
 		
@@ -705,7 +705,7 @@ NET_BEGIN:
 	ret = rt_listen (sk_server, 1);
 	if (ret < 0)
 	{
-		RT_PRINTF_POSITION();
+		// RT_PRINTF_POSITION();
 		rt_socket_close (sk_server);
 		g_ts_104[net] = 0;
 		

+ 29 - 79
dtu/dtu_main_t536/app/net_debug.c

@@ -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':         

+ 19 - 3
dtu/dtu_main_t536/app/net_maintain.c

@@ -260,7 +260,7 @@ int net_maintain_exit(void)
 	if(g_mt_zombie_flag)
 	{
 		// 关闭端口服务
-		//net_debug_exit();
+		net_debug_exit();
 	   
 		close_inet_port();
  
@@ -292,7 +292,7 @@ int net_maintain_send(unsigned char *buf,int len)
 void open_inet_port(void)
 {
 	char *envp[] = { NULL };
-	char *cmd[] = {"/usr/sbin/vsftpd", "/etc/vsftpd.conf &",  NULL};
+	char *cmd[] = {"/etc/init.d/inetd", "start",  NULL};
 
 	if(port_openflag)
 	{
@@ -302,7 +302,7 @@ void open_inet_port(void)
 
 	port_openflag = 1;
 	//调用shell脚本,打开对应端口	
-	call_usermodehelper("/usr/sbin/vsftpd",  cmd,  envp,  UMH_NO_WAIT);
+	call_usermodehelper("/etc/init.d/inetd",  cmd,  envp,  UMH_NO_WAIT);
 }
 #else
 void open_inet_port(void)
@@ -350,6 +350,22 @@ void open_inet_port(void)
 #ifdef CPU_FUXI
 void close_inet_port(void)
 {
+	char *envp[] = { NULL };
+	char *cmd0[] = {"/usr/bin/killall", "telnetd",  NULL}; // sunxi 20220727 added
+	char *cmd1[] = {"/usr/bin/killall", "vsftpd",  NULL}; // sunxi 20220822 added
+	char *cmd[] = {"/etc/init.d/inetd", "stop",  NULL};
+
+	if(!port_openflag)
+	{
+		return;
+	}	
+
+	port_openflag = 0;
+	
+	//调用shell脚本,关闭对应端口
+	call_usermodehelper("/usr/bin/killall",  cmd0,  envp,  UMH_WAIT_PROC); // sunxi 20220727 added
+	call_usermodehelper("/usr/bin/killall",  cmd1,  envp,  UMH_WAIT_PROC); // sunxi 20220822 added
+	call_usermodehelper("/etc/init.d/inetd",  cmd,  envp,  UMH_WAIT_PROC);
 }
 #else
 void close_inet_port(void)

+ 2 - 2
dtu/dtu_main_t536/app/set.c

@@ -2739,7 +2739,7 @@ const  TSETTABLE tEquipParaTable[]=     			// min 	max 			default
 	#if defined(NET3_IP5) || defined(NET4_IP5)
 		//{SETTYPE_LIST,	SET_NULL,	"3#_网络", 			0 , 	Net_Eth_ListNum-1,	3 ,		Net_Eth_List,	Net_Eth_ListNum,GROUP_PARA_ETHERNET,0x0000, UINT_R},
 		{SETTYPE_LIST,	SET_NULL,	"1#_网络", 			0 , 	Net_Eth_ListNum-1,	0 ,		Net_Eth_List,	Net_Eth_ListNum,GROUP_PARA_ETHERNET,0x0000, UINT_R},
-		{SETTYPE_IP,	SET_NULL,	"1#IP地址", 		0 , 	0xffffffff,			0 ,	(void *)0xc0a801F0,	0,				GROUP_PARA_ETHERNET,0x0000, STR_R}, // IP 192.168.1.100
+		{SETTYPE_IP,	SET_NULL,	"1#IP地址", 		0 , 	0xffffffff,			0 ,	(void *)0xc0a80164,	0,				GROUP_PARA_ETHERNET,0x0000, STR_R}, // IP 192.168.1.100
 		{SETTYPE_IP,	SET_NULL,	"1#子网掩码", 		0 , 	0xffffffff,			0 ,	(void *)0xffffff00,	0,				GROUP_PARA_ETHERNET,0x0000, STR_R}, // 255.255.255.0
 		{SETTYPE_IP,	SET_NULL,	"1#目标网络", 		0 , 	0xffffffff,			0 ,	(void *)0x00000000,	0,				GROUP_PARA_ETHERNET,0x0000, STR_R}, // 192.168.64.240	
 		{SETTYPE_IP,	SET_NULL,	"1#目标掩码", 		0 , 	0xffffffff,			0 ,	(void *)0x00000000,	0,				GROUP_PARA_ETHERNET,0x0000, STR_R}, // 0.0.0.0	
@@ -5738,7 +5738,7 @@ void MakeRunPara(bool bFirstInit, bool bUboot)
 				pRunPara->tUartPara[protocol[hmi_protocol]].wProtocol = 1;
 			}
 		}
-		rt_printf("面板配置超限制");
+		rt_printf("面板配置超限制 \n");
 	}
 	if (fault_protocol > 1)
 	{

+ 3 - 3
dtu/dtu_main_t536/app/switch.c

@@ -3597,7 +3597,7 @@ int _sw_cal_mea(void)
 	static int g_cal_step = 0;
   	uint32_t us0;
 
-	us0 = ustimer_get_origin();
+	us0 = bsp_ustimer_get_origin();
 
 	if(g_cal_step == 0)
 	{
@@ -3611,7 +3611,7 @@ int _sw_cal_mea(void)
 		
 		g_cal_step = 1;
 		
-		rt_stat_other_in(3,ustimer_get_duration(us0)/USTIMER_US);
+		rt_stat_other_in(3,bsp_ustimer_get_duration(us0)/USTIMER_US);
 	}
 	else
 	{
@@ -3630,7 +3630,7 @@ int _sw_cal_mea(void)
 		
 		g_cal_step = 0;
 		
-		rt_stat_other_in(4,ustimer_get_duration(us0)/USTIMER_US);
+		rt_stat_other_in(4,bsp_ustimer_get_duration(us0)/USTIMER_US);
 	}
 	
 

ファイルの差分が大きいため隠しています
+ 150 - 48
dtu/dtu_main_t536/compile_commands.json


BIN
dtu/dtu_main_t536/dtu_t536


+ 14 - 1
dtu/dtu_main_t536/main_mod.c

@@ -53,6 +53,7 @@ enum
 };
 
 pthread_t AW_DTU_PTHREAD_TAB[PTHREAD_MAX_NUM];	//线程表
+struct rt_stat g_stat_periodus_5ms;
 
 int app_main (void *arg);
 int di_do_adc (void *arg);
@@ -175,7 +176,7 @@ int kernel_callback(void)
 	{
 		hzk_exit();
 		led_exit();
-		//net_debug_exit();
+		net_debug_exit();
 		net_debug_s_exit();
 		if(g_exit_completion_gprs_net_IEC_proc)
 		{
@@ -299,14 +300,24 @@ int di_do_adc (void *unused)
 
     //adc_init();
     dido_init();
+	rt_stat_init(&g_stat_periodus_5ms, "pit_5ms_priod(1us)");
     pthread_setschedparam(pthread_self(), SCHED_RR, &sch_par);   // 设置当前线程优先级
 	prctl(PR_SET_NAME, "di_do_adc");
 	rt_printf("Thread created successfully: %s, PID: %d LWP: %d\r\n", 
               	"di_do_adc", (int)getpid(), (int)syscall(SYS_gettid));
     while(1)
     {
+		static u8 flags = 0;
+		static unsigned long us1 = 0;
+		unsigned long origin_ext = 0;
 
         usleep(1000);
+
+		origin_ext = bsp_ustimer_get_origin();
+		if (flags) {
+			rt_stat_in(&g_stat_periodus_5ms, (origin_ext - us1));
+		}
+		
 		watchdog_feed(wdt_id);
         adc_isr(0);			
 		//保护计算
@@ -317,6 +328,8 @@ int di_do_adc (void *unused)
         }
 		// led_polling_5ms(); // ewen 临时测试用	ygl -
 
+		us1 = origin_ext;
+		flags = 1;
     }
 	watchdog_remove_item(wdt_id);
 

BIN
dtu/dtu_main_t536/main_mod.o


この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません