Total errbit statistics added. Sergey.
authorhadaq <hadaq>
Tue, 31 May 2011 15:06:40 +0000 (15:06 +0000)
committerhadaq <hadaq>
Tue, 31 May 2011 15:06:40 +0000 (15:06 +0000)
ebctrl/ioc/ebctrlApp/src/totalerrbitstat.c [new file with mode: 0644]
ebctrl/ioc/ebctrlApp/src/totalerrbitstat.dbd [new file with mode: 0644]

diff --git a/ebctrl/ioc/ebctrlApp/src/totalerrbitstat.c b/ebctrl/ioc/ebctrlApp/src/totalerrbitstat.c
new file mode 100644 (file)
index 0000000..7f36acf
--- /dev/null
@@ -0,0 +1,58 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <stdint.h>
+
+#include <dbDefs.h>
+#include <registryFunction.h>
+#include <subRecord.h>
+#include <genSubRecord.h>
+#include <epicsExport.h>
+
+int totalerrbitstatDebug;
+
+long totalErrBitStat_init(struct genSubRecord   *psub )
+{
+  return(0);
+}
+
+long totalErrBitStat_proc(struct genSubRecord  *psub )
+{
+  int i = 0;
+  uint32_t totalErrBitStat = 0; 
+  uint32_t input[16];
+
+  input[0] = *(uint32_t *)psub->a;
+  input[1] = *(uint32_t *)psub->b;
+  input[2] = *(uint32_t *)psub->c;
+  input[3] = *(uint32_t *)psub->d;
+  input[4] = *(uint32_t *)psub->e;
+  input[5] = *(uint32_t *)psub->f;
+  input[6] = *(uint32_t *)psub->g;
+  input[7] = *(uint32_t *)psub->h;
+  input[8] = *(uint32_t *)psub->i;
+  input[9] = *(uint32_t *)psub->j;
+  input[10] = *(uint32_t *)psub->k;
+  input[11] = *(uint32_t *)psub->l;
+  input[12] = *(uint32_t *)psub->m;
+  input[13] = *(uint32_t *)psub->n;
+  input[14] = *(uint32_t *)psub->o;
+  input[15] = *(uint32_t *)psub->p;
+  
+  for(i=0; i<16; i++){
+    totalErrBitStat = totalErrBitStat + input[i];
+  }
+
+  if(totalerrbitstatDebug){
+    printf("<I> totalerrbitstat.c: total ErrorBit statistics: %lu\n", (unsigned long)totalErrBitStat);
+  }
+
+  *(uint32_t *)psub->vala = (uint32_t)totalErrBitStat;
+
+  return(0);
+}
+
+epicsExportAddress(int, totalerrbitstatDebug);
+epicsRegisterFunction(totalErrBitStat_init);
+epicsRegisterFunction(totalErrBitStat_proc);
diff --git a/ebctrl/ioc/ebctrlApp/src/totalerrbitstat.dbd b/ebctrl/ioc/ebctrlApp/src/totalerrbitstat.dbd
new file mode 100644 (file)
index 0000000..4aca28b
--- /dev/null
@@ -0,0 +1,3 @@
+variable(totalerrbitstatDebug)
+function(totalErrBitStat_init)
+function(totalErrBitStat_proc)
\ No newline at end of file