From f6241f7a5eee333eff1c53b71a66d2554e933e07 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Fri, 18 Nov 2022 14:26:58 +0100 Subject: [PATCH] formatting --- patternGenerator/deserializer.cpp | 176 ++++++----- patternGenerator/generator.c | 275 ++++++++---------- .../slsDetectorFunctionList.c | 3 +- .../slsDetectorServer/src/sharedMemory.c | 7 +- slsReceiverSoftware/src/Arping.cpp | 3 +- 5 files changed, 209 insertions(+), 255 deletions(-) diff --git a/patternGenerator/deserializer.cpp b/patternGenerator/deserializer.cpp index 0a52f4ad9..a77fe1077 100644 --- a/patternGenerator/deserializer.cpp +++ b/patternGenerator/deserializer.cpp @@ -1,112 +1,110 @@ // SPDX-License-Identifier: LGPL-3.0-or-other // Copyright (C) 2021 Contributors to the SLS Detector Package -#include -#include -#include -#include -#include -#include -#include -#include #include -#include #include +#include #include +#include #include +#include #include +#include +#include +#include #include int main(int argc, char *argv[]) { - int iarg; - char fname[10000]; - uint64_t word; - int val[64]; - int bit[64]; - FILE *fdin; - - int nb=2; - int off=0; - int ioff=0; - int dr=24; - int idr=0; - int ib=0; - int iw=0; - bit[0]=19; - bit[1]=8; - // for (iarg=0; iarg2) dr=atoi(argv[2]); - if (argc>3) off=atoi(argv[3]); - if (argc>4) { - for (ib=0; ib<64; ib++) { - if (argc>4+ib) { - bit[ib]=atoi(argv[4+ib]); - nb++; + int iarg; + char fname[10000]; + uint64_t word; + int val[64]; + int bit[64]; + FILE *fdin; + + int nb = 2; + int off = 0; + int ioff = 0; + int dr = 24; + int idr = 0; + int ib = 0; + int iw = 0; + bit[0] = 19; + bit[1] = 8; + // for (iarg=0; iarg 2) + dr = atoi(argv[2]); + if (argc > 3) + off = atoi(argv[3]); + if (argc > 4) { + for (ib = 0; ib < 64; ib++) { + if (argc > 4 + ib) { + bit[ib] = atoi(argv[4 + ib]); + nb++; + } + } } - } - - } - - idr=0; - for (ib=0; ib -#include -#include -#include -#include -#include -#include -#include #include -#include #include +#include #include +#include #include +#include #include +#include +#include +#include #include -#define MAXLOOPS 6 +#define MAXLOOPS 6 #define MAXTIMERS 6 -#define MAXWORDS 8191 +#define MAXWORDS 8191 +uint64_t pat = 0; +uint64_t iopat = 0; +uint64_t clkpat = 0; - -uint64_t pat=0; -uint64_t iopat=0; -uint64_t clkpat=0; - -unsigned iaddr=0; -unsigned waitaddr[MAXTIMERS]={MAXWORDS,MAXWORDS,MAXWORDS, MAXWORDS, MAXWORDS, MAXWORDS}; -unsigned startloopaddr[MAXLOOPS]={MAXWORDS,MAXWORDS,MAXWORDS, MAXWORDS, MAXWORDS, MAXWORDS}; -unsigned stoploopaddr[MAXLOOPS]={MAXWORDS,MAXWORDS,MAXWORDS, MAXWORDS, MAXWORDS, MAXWORDS}; -unsigned start=0, stop=0; -uint64_t waittime[MAXTIMERS]={0,0,0,0,0,0}; -unsigned nloop[MAXLOOPS]={0,0,0,0,0,0}; +unsigned iaddr = 0; +unsigned waitaddr[MAXTIMERS] = {MAXWORDS, MAXWORDS, MAXWORDS, + MAXWORDS, MAXWORDS, MAXWORDS}; +unsigned startloopaddr[MAXLOOPS] = {MAXWORDS, MAXWORDS, MAXWORDS, + MAXWORDS, MAXWORDS, MAXWORDS}; +unsigned stoploopaddr[MAXLOOPS] = {MAXWORDS, MAXWORDS, MAXWORDS, + MAXWORDS, MAXWORDS, MAXWORDS}; +unsigned start = 0, stop = 0; +uint64_t waittime[MAXTIMERS] = {0, 0, 0, 0, 0, 0}; +unsigned nloop[MAXLOOPS] = {0, 0, 0, 0, 0, 0}; char infile[10000], outfile[10000]; @@ -48,175 +47,137 @@ FILE *fd, *fd1; uint64_t PAT[MAXWORDS]; int iopat_enable = 0; +int i, ii, iii, j, jj, jjj, pixx, pixy, memx, memy, muxout, memclk, colclk, + rowclk, muxclk, memcol, memrow, loopcounter; -int i,ii,iii,j,jj,jjj,pixx,pixy,memx,memy,muxout,memclk,colclk,rowclk,muxclk,memcol,memrow,loopcounter; +void setstart() { start = iaddr; } -void setstart() -{ - start=iaddr; +void setstop() { stop = iaddr; } + +void setinput(int bit) { + uint64_t mask = 1; + mask = mask << bit; + iopat &= ~mask; + iopat_enable = 1; } -void setstop() -{ - stop=iaddr; +void setoutput(int bit) { + uint64_t mask = 1; + mask = mask << bit; + iopat |= mask; + iopat_enable = 1; } -void setinput(int bit) -{ - uint64_t mask=1; - mask=mask<> bit; } -void clearbit(int bit) -{ - uint64_t mask=1; - mask=mask<>bit; -} - -void setstartloop(int iloop) -{ - if (iloop>=0 && iloop= 0 && iloop < MAXLOOPS) { + startloopaddr[iloop] = iaddr; } } - -void setstoploop(int iloop) -{ - if (iloop>=0 && iloop= 0 && iloop < MAXLOOPS) { + stoploopaddr[iloop] = iaddr; } } - -void setnloop(int iloop, int n) -{ - if (iloop>=0 && iloop= 0 && iloop < MAXLOOPS) { + nloop[iloop] = n; } } -void setwaitpoint(int iloop) -{ - if (iloop>=0 && iloop= 0 && iloop < MAXTIMERS) { + waitaddr[iloop] = iaddr; } } - -void setwaittime(int iloop, uint64_t t) -{ - if (iloop>=0 && iloop= 0 && iloop < MAXTIMERS) { + waittime[iloop] = t; } } - -void pw() -{ - if (iaddr=MAXWORDS) - { - printf("ERROR: too many word in the pattern (%d instead of %d)!",iaddr, MAXWORDS); + fprintf(fd, "patword 0x%04x 0x%016llx\n", iaddr, pat); + iaddr++; + if (iaddr >= MAXWORDS) { + printf("ERROR: too many word in the pattern (%d instead of %d)!", iaddr, + MAXWORDS); } } -int parseCommand(int clk, int cmdbit, int cmd, int length) -{ - int ibit; - clearbit(clk); - for (ibit=0; ibit>ibit)) - { - setbit(cmdbit); - } - else - { - clearbit(cmdbit); - } - pw(); - /******/ - setbit(clk); - pw(); - /******/ +int parseCommand(int clk, int cmdbit, int cmd, int length) { + int ibit; + clearbit(clk); + for (ibit = 0; ibit < length; ibit++) { + if (cmd & (1 >> ibit)) { + setbit(cmdbit); + } else { + clearbit(cmdbit); + } + pw(); + /******/ + setbit(clk); + pw(); + /******/ } }; - - int main() { - int iloop=0; - fd=fopen(OUTFILE,"w"); + int iloop = 0; + fd = fopen(OUTFILE, "w"); #include INFILE - fprintf(fd,"patlimits 0x%04x 0x%04x\n",start, stop); + fprintf(fd, "patlimits 0x%04x 0x%04x\n", start, stop); - if (iopat_enable == 1) - { - fprintf(fd,"patioctrl 0x%016llx\n",iopat); - } - - for (iloop=0; ilooplockAcqFlag), &lockAcqFlagAttribute) != - 0) { + if (pthread_mutex_init(&(shm->lockAcqFlag), &lockAcqFlagAttribute) != 0) { LOG(logERROR, ("Failed to initialize pthread_mutex_t lockAcqFlag for " "shared memory\n")); return FAIL; @@ -293,7 +292,5 @@ void sharedMemory_unlockLocalLink() { void sharedMemory_lockAcqFlag() { pthread_mutex_lock(&(shm->lockAcqFlag)); } -void sharedMemory_unlockAcqFlag() { - pthread_mutex_unlock(&(shm->lockAcqFlag)); -} +void sharedMemory_unlockAcqFlag() { pthread_mutex_unlock(&(shm->lockAcqFlag)); } #endif \ No newline at end of file diff --git a/slsReceiverSoftware/src/Arping.cpp b/slsReceiverSoftware/src/Arping.cpp index 01330a216..3431737f5 100644 --- a/slsReceiverSoftware/src/Arping.cpp +++ b/slsReceiverSoftware/src/Arping.cpp @@ -14,8 +14,7 @@ namespace sls { #define gettid() syscall(SYS_gettid) #endif - -Arping::Arping(){} +Arping::Arping() {} Arping::~Arping() { if (IsRunning()) {