diff --git a/examples/pingpong/src/decode.c~ b/examples/pingpong/src/decode.c~ deleted file mode 100644 index 466ccf0c86366990eb1aec01da61a3083ecb6c84..0000000000000000000000000000000000000000 --- a/examples/pingpong/src/decode.c~ +++ /dev/null @@ -1,184 +0,0 @@ -/* - ************************************************************************** - * SOURCE FILE - ************************************************************************** - * - * decode.c - - * - ************************************************************************** - */ - -/** - ************************************************************************** - * \file decode.c - * \brief na - * \author na - * \version na - * \date na - ************************************************************************** - */ - -/* - ************************************************************************** - * INCLUDES - ************************************************************************** - */ -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include "smi.h" -#include "profile.h" -#include "logging.h" - -/* - ************************************************************************** - * DEFINES - ************************************************************************** - */ -#define DECODE_SMI 1 -#define DECODE_PROFILE 1 - -/* - ************************************************************************** - * MAIN - ************************************************************************** - */ -int main(int argc, char *argv[]){ - - FILE *fp; - char fileName[BUFSIZ]; - unsigned char id; - int size,n,count; - -#if(DECODE_SMI) - unsigned char initSmi = 0; - int smiLogStateIndex=0; - smiLogEntryStruct smiLogEntry; - logSmi1Struct smi1; - logSmi2Struct smi2; - FILE *fpSmi=NULL; -#endif - - -#if(DECODE_PROFILE) - unsigned char initTaskProfile = 0; - TaskProfileLogStruct taskProfile; - FILE *fpTaskProfile=NULL; -#endif - - /* Check the input arguments */ - if (argc != 2) - { - printf("\nInvalid args\nUsage: decode <log filename> \n\n"); - return -1; - } - strcpy(fileName,argv[1]); - - count=0; - fp=fopen(fileName,"rb"); - if (fp==NULL) { - printf("[decode] error opening log file %s \n", fileName); - return EXIT_FAILURE; - } else { - printf("[decode] reading log file %s\n", fileName); - } - - do { - n=fread((void *)&id,1,1,fp); // read struct identifier - if (n==1) { - - switch (id) { - -#if(DECODE_SMI) - case SMI1_LOGID: - if (initSmi == 0) { - printf("[decode] opening SMI.log\n"); - fpSmi=fopen("SMI.log","w"); - if (fpSmi==NULL) { - printf("[decode] error opening SMI.log \n"); - return EXIT_FAILURE; - } - initSmi = 1; - } - if (initSmi==2) { - printf("[decode] error smi1 before end of smi2"); - return EXIT_FAILURE; - } - smiLogStateIndex=0; -// printf("[decode] reading smi1 %d\n",count); - size=sizeof(logSmi1Struct); - n=fread((void *)&smi1,1,size,fp); - initSmi=2; - break; - case SMI2_LOGID: - if (initSmi==0) { - printf("[decode] error smi2 before smi1\n"); - return EXIT_FAILURE; - - } -// printf("[decode] reading smi2 %d\n",count); - size=sizeof(logSmi2Struct); - n=fread((void *)&smi2,1,size,fp); - smiLogEntry.smiFlagsLogBuf[smiLogStateIndex]=smi2.flags; - smiLogEntry.smiStateLogBuf[smiLogStateIndex]=smi2.state; - smiLogStateIndex++; - if (smiLogStateIndex>=MAX_NUMBER_OF_CONCURRENT_STATES) { - printf("[decode] smiLogStateIndex out of range\n"); - return EXIT_FAILURE; - } - if (smiLogStateIndex==smi1.numberOfStates) { - int i; - fprintf(fpSmi,"%d %d %d ", smi1.time,smi1.numberOfStates,smi1.smiIteration); - for (i=0;i<smiLogStateIndex;i++) { - fprintf(fpSmi,"%d %d ",smiLogEntry.smiStateLogBuf[i],smiLogEntry.smiFlagsLogBuf[i]); - } - fprintf(fpSmi,"\n"); - initSmi=1; - } - break; -#endif - -#if(DECODE_PROFILE) - case PROFILE_LOGID: - if (initTaskProfile == 0) { - printf("[decode] opening TaskProfile.log\n"); - fpTaskProfile=fopen("TaskProfile.log","w"); - if (fpTaskProfile==NULL) { - printf("[decode] error opening TaskProfile.log \n"); - return EXIT_FAILURE; - } - initTaskProfile = 1; - } - #if(DECODE_PRINT_OUTPUT) - printf("[decode] reading TaskProfile %d\n",count); - #endif - size=sizeof(TaskProfileLogStruct); - n=fread((void *)&taskProfile,1,size,fp); - fprintf(fpTaskProfile,"%d %d %d %lld %lld %lld %lld %lld\n", - taskProfile.taskID, - taskProfile.runs, - taskProfile.overruns, - taskProfile.duration, - taskProfile.mean, - taskProfile.variance, - taskProfile.maximum, - taskProfile.minimum); - break; - -#endif - - default: - printf("[decode] error: unknown LOGID=%d\n", id); - fclose(fp); - return EXIT_FAILURE; - } - - count++; - - } - } while (n>0); - - fclose(fp); - return EXIT_SUCCESS; -} diff --git a/examples/pingpong/src/nrt.c.ok b/examples/pingpong/src/nrt.c.ok deleted file mode 100644 index b8c8acb125c6552060ddcbbc342b19a2c7055b13..0000000000000000000000000000000000000000 --- a/examples/pingpong/src/nrt.c.ok +++ /dev/null @@ -1,73 +0,0 @@ -/* - ************************************************************************** - * SOURCE FILE - ************************************************************************** - * - * nrt.c - non-real-time system process - * - ************************************************************************** - */ - -/** - ************************************************************************** - * \file nrt.c - * \brief na - * \author na - * \version na - * \date na - ************************************************************************** - */ - -/* - ************************************************************************** - * INCLUDES - ************************************************************************** - */ -#include <stdlib.h> -#include <stdio.h> - -#include "smi.h" - -#include "rtshm.h" - -/* - ************************************************************************** - * GLOBALS - ************************************************************************** - */ -rtshm_struct *rtshm; -int rtshm_fd; - -/* - ************************************************************************** - * NRT MAIN - ************************************************************************** - */ -int main(int argc,char *argv[]){ - char *esmFile,*tssFile,*tdeFile,*cfgFile; - int i; - - if (argc==5) { - esmFile=argv[1]; - tssFile=argv[2]; - tdeFile=argv[3]; - cfgFile=argv[4]; - } else { - esmFile=tssFile=tdeFile=cfgFile=NULL; - printf("[nrt] esm tss tde cfg required\n"); - } - - printf("[nrt] allocating RT shared memory\n"); - if (initShm(&rtshm_fd,sizeof(rtshm_struct),(void *) &rtshm,RTSHM_FILE)!=0) { - return EXIT_FAILURE; - } - - i=nrtSmi(esmFile,tssFile,tdeFile,cfgFile); - - printf("[nrt] releasing RT shared memory\n"); - closeShm(rtshm_fd,RTSHM_FILE); - - if (i==0) return EXIT_SUCCESS; - else return EXIT_FAILURE; -} - diff --git a/examples/pingpong/src/nrt.c~ b/examples/pingpong/src/nrt.c~ deleted file mode 100644 index 2501dbf9f6b5e0b0584f312efc73b45c49467ae4..0000000000000000000000000000000000000000 --- a/examples/pingpong/src/nrt.c~ +++ /dev/null @@ -1,73 +0,0 @@ -/* - ************************************************************************** - * SOURCE FILE - ************************************************************************** - * - * nrt.c - non-real-time system process - * - ************************************************************************** - */ - -/** - ************************************************************************** - * \file nrt.c - * \brief na - * \author na - * \version na - * \date na - ************************************************************************** - */ - -/* - ************************************************************************** - * INCLUDES - ************************************************************************** - */ -#include <stdlib.h> -#include <stdio.h> - -#include "smi.h" - -#include "rtshm.h" - -/* - ************************************************************************** - * GLOBALS - ************************************************************************** - */ -rtshm_struct *rtshm; -int rtshm_fd; - -/* - ************************************************************************** - * NRT MAIN - ************************************************************************** - */ -int main(int argc,char *argv[]){ - char *esmFile,*tssFile,*tdeFile,*cfgFile; - int i; - - if (argc==5) { - esmFile=argv[1]; - tssFile=argv[2]; - tdeFile=argv[3]; - cfgFile=argv[4]; - } else { - esmFile=tssFile=tdeFile=cfgFile=NULL; - printf("[nrt.c: main] esm tss tde cfg required\n"); - } - - printf("[nrt.c: main] allocating %ldkB RT shared memory\n",(long int)sizeof(rtshm_struct)/1024); - if (initShm(&rtshm_fd,sizeof(rtshm_struct),(void *) &rtshm,RTSHM_FILE)!=0) { - return EXIT_FAILURE; - } - - i=nrtSmi(esmFile,tssFile,tdeFile,cfgFile); - - printf("[nrt.c: main] releasing RT shared memory\n"); - closeShm(rtshm_fd,RTSHM_FILE); - - if (i==0) return EXIT_SUCCESS; - else return EXIT_FAILURE; -} - diff --git a/examples/pingpong/src/nrt_task.c~ b/examples/pingpong/src/nrt_task.c~ deleted file mode 100644 index 80fb596462f017a1e22d0a692d95846316c48a65..0000000000000000000000000000000000000000 --- a/examples/pingpong/src/nrt_task.c~ +++ /dev/null @@ -1,71 +0,0 @@ -/* - ************************************************************************** - * SOURCE FILE - ************************************************************************** - * - * nrt_task.c - non-real-time user processes - * - ************************************************************************** - */ - -/** - ************************************************************************** - * \file nrt.c - * \brief na - * \author na - * \version na - * \date na - ************************************************************************** - */ - -/* - ************************************************************************** - * INCLUDES - ************************************************************************** - */ - - -#include <stdlib.h> -#include <stdio.h> - -#include "smi.h" - -#include "rtshm.h" - -/* - ************************************************************************** - * GLOBALS - ************************************************************************** - */ -rtshm_struct *rtshm; -int rtshm_fd; - -/* - ************************************************************************** - * NRT TASK MAIN - ************************************************************************** - */ - -int main(int argc,char *argv[]){ - int nrtProcessID; - - if (argc==2) { - nrtProcessID=atof(argv[1]); - printf("[nrt_task.c:main] nrtProcessID=%d\n",nrtProcessID); - } else { - printf("[nrt_task.c:main] nrtProcessID missing\n"); - return EXIT_FAILURE; - } - - printf("[nrt_task.c:main] allocating RT shared memory\n"); - if (initShm(&rtshm_fd,sizeof(rtshm_struct),(void *) &rtshm,RTSHM_FILE)!=0) { - return EXIT_FAILURE; - } - - nrtTask(nrtProcessID); - - printf("[nrt_task.c:main] releasing RT shared memory\n"); - closeShm(rtshm_fd,RTSHM_FILE); - - return EXIT_SUCCESS; -} diff --git a/examples/pingpong/src/rt.c~ b/examples/pingpong/src/rt.c~ deleted file mode 100644 index 2a308dd70d305ef5f154914b7d2d6f35907f99e9..0000000000000000000000000000000000000000 --- a/examples/pingpong/src/rt.c~ +++ /dev/null @@ -1,72 +0,0 @@ -/* - ************************************************************************** - * SOURCE FILE - ************************************************************************** - * - * rt.c - real-time system process - * - ************************************************************************** - */ - -/** - ************************************************************************** - * \file rt.c - * \brief na - * \author na - * \version na - * \date na - ************************************************************************** - */ - -/* - ************************************************************************** - * INCLUDES - ************************************************************************** - */ -#include <stdlib.h> -#include <stdio.h> - -#include "smi.h" - -#include "rtshm.h" - -/* - ************************************************************************** - * GLOBALS - ************************************************************************** - */ -rtshm_struct *rtshm; -int rtshm_fd; - - RTIME maxIoTime=0; - -/* - ************************************************************************** - * RT MAIN - ************************************************************************** - */ -int main(int argc,char *argv[]){ - int i; - - printf("[rt.c: main] allocating RT shared memory\n"); - if (initShm(&rtshm_fd,sizeof(rtshm_struct),(void *) &rtshm,RTSHM_FILE)!=0) { - return EXIT_FAILURE; - } - - rtshm->ustime.lock=ATOMIC_UNLOCKED0; - rtshm->ustime.time=0; - rtshm->ustime.localtime[0]='\0'; - rtshm->gnssTime=0; - rtshm->keyboard.status=KEYBOARD_STATUS_ERROR; - - for (i=0;i<MAX_NUMBER_OF_IO_REGIONS;i++) rtshm->regionList[i]=0; - - rtSmi(); - - printf("[rt.c: main] releasing RT shared memory\n"); - closeShm(rtshm_fd,RTSHM_FILE); - - if (maxIoTime>0) printf("[rt.c: main] max IO time: %d\n",(int)maxIoTime); - - return EXIT_SUCCESS; -}