V125-260722:(暂时发现DPD/FSSI/网页频谱显示都不正常,临时提交)1.合并增加 Web 端 FPGA .mcs 在线升级功能,支持升级进度及错误状态反馈。2.合并优化 FPGA 升级后的恢复流程,实现无需断电的 FPGA 配置、JESD 链路及 RF 热恢复。3.合并重构 ORx 功率、FSSI 和 FWD 计算;4.合并DPD相关优化和调试日志;5.合并IQ 频谱数据接收由 eth1 调整至 eth0,降低对外部网口连接状态的依赖。
This commit is contained in:
Executable
+49
@@ -0,0 +1,49 @@
|
||||
########################################################################
|
||||
#
|
||||
# ORIGIN: OneShu .
|
||||
# GROUP:
|
||||
# PROJECT: USED FOR GCC Makefile
|
||||
# DATE: Nov 2022.
|
||||
# PURPOSE: Standard application makefile
|
||||
#
|
||||
# NOTE: This include makefile assumes the source modules
|
||||
# are organised into the linux directory structure.
|
||||
#
|
||||
# $Revision: $
|
||||
# $Date: $
|
||||
########################################################################
|
||||
|
||||
TARGET_APP = loglog
|
||||
C_LIB=libloglog.a
|
||||
########################################################################
|
||||
|
||||
CC = arm-poky-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/opt/fsl-imx-x11/4.1.15-2.0.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi
|
||||
|
||||
C_SOURCE += main.c loglog.c
|
||||
C_LIB_SOURCE += loglog.c
|
||||
|
||||
########################################################################
|
||||
|
||||
C_OBJECT = $(patsubst %.c,%.o,$(C_SOURCE))
|
||||
C_LIB_OBJECT = $(patsubst %.c,%.o,$(C_LIB_SOURCE))
|
||||
|
||||
%.o:%.c
|
||||
$(CC) $(CFLAGS) -c -g $< -o $@ $(INCLUDES) $(PROJ_CPL_MACRO)
|
||||
|
||||
all:$(TARGET_APP)
|
||||
|
||||
|
||||
lib:$(C_LIB)
|
||||
|
||||
clean:
|
||||
rm -rf $(C_OBJECT) $(C_LIB_OBJECT) $(C_LIB) $(TARGET_APP)
|
||||
|
||||
$(TARGET_APP):$(C_OBJECT)
|
||||
$(CC) -o $@ -g $(C_OBJECT) -lpthread -Wl,--start-group -Wl,--end-group
|
||||
|
||||
$(C_LIB):$(C_LIB_OBJECT)
|
||||
|
||||
install:$(TARGET_APP)
|
||||
cp -f $(TARGET_APP) ../../out/upgrade_imx_fs/SMOD/src/usr/sbin/
|
||||
cp -f $(TARGET_APP) ../../out/rootfs/usr/sbin/
|
||||
@echo "\n\n\t $(TARGET_APP) intall ok\n\n"
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
该模块用于记录打印日志,支持以下两种使用方式:
|
||||
|
||||
1、独立的应用
|
||||
|
||||
执行命令make clean;make,编译生成可执行程序loglog。
|
||||
|
||||
使用方法:
|
||||
|
||||
通过管道命令记录其他应用打印,如:./app | loglog /var/module_log/ app.log。
|
||||
|
||||
2、可集成的功能模块
|
||||
|
||||
执行命令make clean;make lib CFLAGS=-DAS_INTEGRATION_INTERFACE,编译生成libloglog.a。
|
||||
|
||||
使用方法:
|
||||
|
||||
包含loglog.h,将libloglog.a集成到需要记录打印日志的应用,在应用开始处调用log_init。
|
||||
Executable
BIN
Binary file not shown.
@@ -0,0 +1,126 @@
|
||||
#include "loglog.h"
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define DEBUG_ENABLE 0
|
||||
|
||||
#define DATE_TIME_LEN 22
|
||||
#define MAX_STDIN_DATA_LEN 1024
|
||||
#define MAX_BUF_LEN MAX_STDIN_DATA_LEN+DATE_TIME_LEN
|
||||
#define MAX_PATH_OR_NAME_LEN 128
|
||||
#define ERROR_MESSAGE "ERROR:The program may exit abnormally!\n"
|
||||
|
||||
#if DEBUG_ENABLE
|
||||
#define debugf printf
|
||||
#else
|
||||
#define debugf
|
||||
#endif
|
||||
|
||||
static char logFile[MAX_PATH_OR_NAME_LEN]={0};
|
||||
static char buf[MAX_BUF_LEN];
|
||||
static char dateTime[DATE_TIME_LEN+1];
|
||||
static bool s_bOutput;
|
||||
|
||||
static void* log_task(void *arg)
|
||||
{
|
||||
struct tm *pTm;
|
||||
time_t now;
|
||||
int fd;
|
||||
ssize_t size;
|
||||
char *pRet;
|
||||
struct stat fileStat;
|
||||
const char *fileName=(const char *)arg;
|
||||
int bReopen=0;
|
||||
|
||||
FILE_REOPEN:
|
||||
|
||||
fd=open(fileName,O_CREAT|O_WRONLY|O_APPEND,0644);
|
||||
if(fd==-1)
|
||||
{
|
||||
printf("open %s error\n",fileName);
|
||||
return ((void *)NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
bReopen=1;
|
||||
printf("open %s successfully!\n",fileName);
|
||||
}
|
||||
|
||||
while(1)
|
||||
{
|
||||
if(bReopen==0&&stat(fileName,&fileStat)==0)
|
||||
{
|
||||
if(fileStat.st_size==0)
|
||||
{
|
||||
printf("%s was recreated by the outside world so reopen %s\n",fileName,fileName);
|
||||
close(fd);
|
||||
goto FILE_REOPEN;
|
||||
}
|
||||
}
|
||||
|
||||
memset(buf,0,MAX_BUF_LEN);
|
||||
pRet=fgets(&buf[DATE_TIME_LEN],MAX_STDIN_DATA_LEN-1,stdin);
|
||||
if(pRet==NULL)
|
||||
{
|
||||
strcpy(&buf[DATE_TIME_LEN],ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
now=time(NULL);
|
||||
pTm=localtime((const time_t *)&now);
|
||||
if(pTm==NULL)
|
||||
{
|
||||
debugf("localtime is NULL!\n");
|
||||
return (void *)NULL;
|
||||
}
|
||||
|
||||
sprintf(dateTime,"[%04d-%02d-%02d %02d:%02d:%02d] ",
|
||||
pTm->tm_year+1900,pTm->tm_mon+1,pTm->tm_mday,
|
||||
pTm->tm_hour,pTm->tm_min,pTm->tm_sec);
|
||||
strncpy(buf,dateTime,DATE_TIME_LEN);
|
||||
debugf("dateTime:%s\n",dateTime);
|
||||
|
||||
if(s_bOutput)
|
||||
{
|
||||
printf("%s",buf);
|
||||
}
|
||||
|
||||
size=strlen(&buf[DATE_TIME_LEN]);
|
||||
size=write(fd,buf,DATE_TIME_LEN+size);
|
||||
if(size>0)
|
||||
{
|
||||
bReopen=0;
|
||||
debugf("write to %s :\nlen :%d\ndata :%s\n",fileName,size,buf);
|
||||
}
|
||||
|
||||
if(pRet==NULL)
|
||||
{
|
||||
debugf(ERROR_MESSAGE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
close(fd);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
void log_init(const char *logPath,const char *logName,bool bOutput)
|
||||
{
|
||||
pthread_t threadLog;
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
|
||||
assert( logPath!=NULL && logName!=NULL );
|
||||
|
||||
sprintf(logFile,"%s%s",logPath,logName);
|
||||
|
||||
s_bOutput=bOutput;
|
||||
printf("<%s> logPath:%s logName:%s %s\n",__FUNCTION__,logPath,logName,s_bOutput?"proutlog":"noprout");
|
||||
log_task((void *)logFile);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef _LOG_LOG_H_
|
||||
#define _LOG_LOG_H_
|
||||
|
||||
typedef int bool;
|
||||
|
||||
void log_init(const char *logPath,const char *logName,bool bOutput);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "loglog.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void main(int argc,char **args)
|
||||
{
|
||||
if(argc<4)
|
||||
{
|
||||
printf("Usage:%s logPath logName\nFor example:%s /var/module_log/ app.log 0\n",
|
||||
args[0],args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
log_init(args[1],args[2],!strcmp(args[3],"1"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user