]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
*** empty log message ***
authorhades <hades>
Wed, 6 Jun 2001 15:49:02 +0000 (15:49 +0000)
committerhades <hades>
Wed, 6 Jun 2001 15:49:02 +0000 (15:49 +0000)
hadaq/ansiTape.c
hadaq/ansiTape.h
hadaq/ansiTapeChar.c
hadaq/ansiTapeLabel.c
hadaq/ansiTapeLabel.h
hadaq/evtbuild.c
hadaq/hwship.c
hadaq/hwsoft.c
hadaq/param.tcl

index 7a95ae5325d7c71df437696e437ffbf01c4aa626..ecb7ea4611b1eb67ff671709e64b66614b5fa472 100644 (file)
@@ -51,6 +51,9 @@ AnsiTape *openAnsiTape(const char* filename, const char *dev) {
        }
 
        mtoper->mt_op = MTBSF;
+       /* BUGBUG this varies from tape to tape.     *
+        * Old DLT III drives seem to work with 2,   *
+        * the new DLT 8000 needs 3. To investigate. */
        mtoper->mt_count = 3;
        stat = ioctl(tape, MTIOCTOP, mtoper);
        if (stat == -1) {
index 444259376a5188fe3dd4a503b7a2d1c51edb426b..cd6d5af48585088ae3f8798762b3d41aa635ba4d 100644 (file)
@@ -8,16 +8,15 @@ typedef struct AnsiTapeS {
 
        unsigned int bufferFull;
        unsigned long bytesWritten;
-       char buf[8192];
+       char buf[BLOCKSIZE];
 
        const char *filename;
        int fileSeqNum;
 } AnsiTape;
 
-AnsiTape *openAnsiTape(const char *);
+AnsiTape *openAnsiTape(const char *, const char *);
 
 int writeAnsiTape(AnsiTape *, const char *, size_t);
-
 int closeAnsiTape(AnsiTape *);
 
 #endif
index 2969a38e7c8c6d0b128f5609abf2a3c54936ed23..68d870742d7ae1db13a739559bf90f8009e94b81 100644 (file)
@@ -1,6 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/ansiTapeChar.c,v 1.3 2001-03-07 16:02:43 hades Exp $";
-
-#include <hadesstd.h>
+#include <ctype.h>
 
 #include "ansiTapeChar.h"
 
@@ -54,7 +52,9 @@ char *ansichar(char *s, int length) {
 }
 
 char *unixchar(char *s, int length) {
-       int i, end = 0;
+       int i;
+       int end = 0;
+
        for(i=0 ; i<length ; i++) {
                if (end == 0) {
                        if(s[i] == '\0') {
index 2f917ca7534c974397672ef48b5c0b75e670c702..31f47896fbd0079e1db1a69a3ce607d7a69cd3da 100644 (file)
@@ -1,19 +1,10 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/ansiTapeLabel.c,v 1.7 2001-03-07 16:02:43 hades Exp $";
-
-/* For msglog() */
-#include <hadesstd.h>
-#include <errno.h>
-/* For allocMem(), freeMem() */
-#include <hadesstd.h>
-/* For memcpy() */
-#include <string.h>
 #include <stdio.h>
-
-/* For read(), write(), gethostname() */
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <time.h>
 #include <unistd.h>
 
-/* For time() */
-#include <time.h>
 /* For getpwent() */
 #include <pwd.h>
 #include <sys/types.h>
@@ -21,77 +12,66 @@ static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hada
 #include <unistd.h>
 #include <sys/types.h>
 
+#include "ansiTape.h"
 #include "ansiTapeChar.h"
 #include "ansiTapeLabel.h"
 
 /* Functions concerning the volume label */
 
-char *readVolumeLabel(int tape) {
-       char *vol;
+int readVolumeLabel(int tape, char *vol) {
        int stat;
-       vol = allocMem(80*sizeof(char));
-       stat = read(tape, vol, 80);
-       if(stat != 80) {
-               vol = 0;
+       stat = read(tape, vol, LABELSIZE);
+       if(stat != LABELSIZE) {
+               return -1;
        }
 
-       return vol;
-       freeMem(vol);
+       return 0;
 }
 
-int writeVolumeLabel(const char *vol, int tape) {
-       char *v;
+int writeVolumeLabel(int tape, const char *vol) {
        int stat;
-       v = allocMem(80*sizeof(char));
-       memcpy(v, vol, 80);
-       stat = write(tape, v, 80);
-       if(stat != 80) {
-               msglog(LOG_ERR, "Could not write volume label to tape!\n");
-               exit(-3);
+
+       stat = write(tape, vol, LABELSIZE);
+       if(stat != LABELSIZE) {
+               syslog(LOG_ERR, "Could not write volume label to tape.");
+               return -1;
        }
 
-       freeMem(v);
        return 0;
 }
 
-int writeNewVolumeLabel(const char *volId, const char *ownerId, int tape) {
-       char *vol, *oid;
+int writeNewVolumeLabel(int tape, const char *volId, const char *ownerId) {
        int stat;
-
+       char vol[LABELSIZE];
+       char oid[15];
        const char *impId = "    HADAQ0023";
 
-       vol = allocMem(80*sizeof(char));
-
-       oid = allocMem(15*sizeof(char));
-       if (80 != sprintf(vol, "VOL1HADAQ               %s%s                            4", impId, ansichar(oid, 14))) {
-               msglog(LOG_ERR, "LabelV not 80 char!\n");
-               exit(-3);
+       strncpy(oid, ownerId, 15);
+       if (LABELSIZE != sprintf(vol, "VOL1HADAQ               %s%s                            4", impId, ansichar(oid, 14))) {
+               syslog(LOG_ERR, "Volume label not %d char.", LABELSIZE);
+               return -1;
        }
-       freeMem(oid);
 
-       stat = write(tape, vol, 80);
-       if(stat != 80) {
-               msglog(LOG_ERR, "Could not write volume label to tape!\n");
-               exit(-3);
+       stat = write(tape, vol, LABELSIZE);
+       if(stat != LABELSIZE) {
+               syslog(LOG_ERR, "Could not write volume label to tape.");
+               return -1;
        }
 
-       freeMem(vol);
        return 0;
 }
 
 /* Functions concerning the hdr-label and the eof-label */
 
-int writeLabel(const char *hdreof, int tape, int fileSeqNum, int bytes, const char *filename) {
+static int writeLabel(int tape, const char *hdreof, int fileSeqNum, int bytes, const char *filename) {
        int stat;
        int i;
        int blockSize = BLOCKSIZE;
        char hostname[21];
        char *creaCent;
-       char label[81];
+       char label[LABELSIZE + 1];
        char fn[37];
-
        const char *impId = "    HADAQ0023";
-
        uid_t uid;
        char *user;
        time_t tim;
@@ -107,7 +87,7 @@ int writeLabel(const char *hdreof, int tape, int fileSeqNum, int bytes, const ch
        }
 
        strcpy(fn, filename);
-       if (80 != sprintf(label, "%-3s%1d%-17s%06d%04d%04d%04d%02d%1s%02d%03d%6d%1s%06d%-13s%-7s",
+       if (LABELSIZE != sprintf(label, "%-3s%1d%-17s%06d%04d%04d%04d%02d%1s%02d%03d%6d%1s%06d%-13s%-7s",
                hdreof,
                1,
                ansichar(fn, 17),
@@ -119,22 +99,21 @@ int writeLabel(const char *hdreof, int tape, int fileSeqNum, int bytes, const ch
                creaCent, (cd->tm_year)%100, cd->tm_yday,
                99366,
                " ",
-               (bytes + BLOCKSIZE -1) / BLOCKSIZE,
+               (bytes + BLOCKSIZE - 1) / BLOCKSIZE,
                impId,
                "")
        ) {
-               msglog(LOG_ERR, "Label1 not 80 char!\n");
-               exit(-3);
+               syslog(LOG_ERR, "Label 1 not %d char.", LABELSIZE);
+               return -1;
        }
 
-       stat = write(tape, label, 80);
-       if(stat != 80) {
-               msglog(LOG_ERR, "Could not write ANSI label 1 on tape!\n");
-               perror("And Why?\n");
-               exit(-3);
+       stat = write(tape, label, LABELSIZE);
+       if(stat != LABELSIZE) {
+               syslog(LOG_ERR, "Could not write ANSI label 1 on tape.");
+               return -1;
        }
 
-       if (80 != sprintf(label, "%-3s%1d%1s%05d%05d%-21s%1s%010d%-3s%02d%28s",
+       if (LABELSIZE != sprintf(label, "%-3s%1d%1s%05d%05d%-21s%1s%010d%-3s%02d%28s",
                hdreof,
                2,
                "F",
@@ -147,13 +126,13 @@ int writeLabel(const char *hdreof, int tape, int fileSeqNum, int bytes, const ch
                0,
                "")
        ) {
-               msglog(LOG_ERR, "Label2 not 80 char!\n");
-               exit(-3);
+               syslog(LOG_ERR, "Label 2 not %d char.", LABELSIZE);
+               return -1;
        }
-       stat = write(tape, label, 80);
-       if(stat != 80) {
-               msglog(LOG_ERR, "Could not write ANSI label 2 on tape!\n");
-               exit(-3);
+       stat = write(tape, label, LABELSIZE);
+       if(stat != LABELSIZE) {
+               syslog(LOG_ERR, "Could not write ANSI label 2 on tape.");
+               return -1;
        }
 
        uid = getuid();
@@ -168,7 +147,7 @@ int writeLabel(const char *hdreof, int tape, int fileSeqNum, int bytes, const ch
 
        gethostname(hostname, 20);
 
-       if (80 != sprintf(label, "%-3s%1d%010d%-10s%-20s%-36s",
+       if (LABELSIZE != sprintf(label, "%-3s%1d%010d%-10s%-20s%-36s",
                hdreof,
                3,
                tim,
@@ -176,22 +155,23 @@ int writeLabel(const char *hdreof, int tape, int fileSeqNum, int bytes, const ch
                hostname,
                filename)
        ) {
-               msglog(LOG_ERR, "Label3 not 80 char!\n");
-               exit(-3);
+               syslog(LOG_ERR, "Label 3 not %d char.", LABELSIZE);
+               return -1;
        }
 
-       stat = write(tape, label, 80);
-       if(stat != 80) {
-               msglog(LOG_ERR, "Could not write ANSI label 3 on tape!\n");
-               exit(-3);
+       stat = write(tape, label, LABELSIZE);
+       if(stat != LABELSIZE) {
+               syslog(LOG_ERR, "Could not write ANSI label 3 on tape.");
+               return -1;
        }
        return 0;
 }
 
 int writeHeader(int tape, int fileSeqNum, const char *filename) {
-       return writeLabel("HDR", tape, fileSeqNum, 0, filename);
+       return writeLabel(tape, "HDR", fileSeqNum, 0, filename);
 }
 
 int writeTrailer(int tape, int fileSeqNum, unsigned long numBytes, const char *filename) {
-       return writeLabel("EOF", tape, fileSeqNum, numBytes, filename);
+       return writeLabel(tape, "EOF", fileSeqNum, numBytes, filename);
 }
+
index f90761a5a7c314662959d859ec9cbc6cfbaf5545..c7380a78ae07ba0143c85dfb4719aa011bc9c1a0 100644 (file)
@@ -1,11 +1,11 @@
 #ifndef ANSITAPELABEL_H
 #define ANSITAPELABEL_H
 
-#define BLOCKSIZE 8192
+#define LABELSIZE 80
 
-char *readVolumeLabel(int);
-int writeVolumeLabel(const char *, int);
-int writeNewVolumeLabel(const char *, const char *, int);
+int readVolumeLabel(int, char *);
+int writeVolumeLabel(int, const char *);
+int writeNewVolumeLabel(int, const char *, const char *);
 
 int writeHeader(int, int, const char *);
 int writeTrailer(int, int, unsigned long, const char *);
index ac1c8d1305690489d4ba0770bb6eea1db13f4d5e..9e6bc3a3c0cfaa75e35f0879cfdb2c3659147bf9 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.28 2001-04-26 11:59:49 hades Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.29 2001-06-06 15:49:03 hades Exp $";
 
 
 #define _POSIX_C_SOURCE 199309L
@@ -319,7 +319,7 @@ int main(int argc, char *argv[])
                        exit(EXIT_FAILURE);
                }
        } else if (strcmp(theArgs->outDev, "tape") == 0) {
-               if (NULL == (outTape = openAnsiTape(theArgs->outPath))) {
+               if (NULL == (outTape = openAnsiTape(theArgs->outPath, "/dev/tape"))) {
                        msglog(LOG_NOTICE, "Opening of tape failed (no tape available?): Writing to /dev/null.\n");
                        strcpy(theArgs->outDev, "null");
                        outFile = NULL;
index 167f758dfb7e38a188066cdf1b921352f20b7df3..ec420cec2412605cfcba1545045c9742395b9a5d 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwship.c,v 6.16 2001-05-10 18:29:24 hades Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwship.c,v 6.17 2001-06-06 15:49:04 hades Exp $";
 
 #include <assert.h>
 #include <string.h>
@@ -40,10 +40,10 @@ int conHwShip(HwShip * my, const char *name, const Param *param)
 
   strcpy(my->name, name);
 
-       Param_getInt(param, my->name, "ipc_vmebase", &paramWasFound, &cardBase);
+       Param_getInt(param, my->name, "cardbase", &paramWasFound, &cardBase);
        if (!paramWasFound) {
                msglog(LOG_WARNING,
-                       "Parameter %s(%s) not found, default = 0\n", my->name, "ipc_vmebase");
+                       "Parameter %s(%s) not found, default = 0\n", my->name, "cardbase");
                cardBase = 0;
        }
 
index db3b9f3bedefd315ebb596f5c6b3e9dd226452b2..85974a78c767e2218496500567e8bd26431f11c3 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwsoft.c,v 6.21 2001-04-26 11:59:49 hades Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwsoft.c,v 6.22 2001-06-06 15:49:04 hades Exp $";
 
 
 #define _POSIX_C_SOURCE 199309L
@@ -58,7 +58,7 @@ void deleteHardware(Hardware *my)
 
 void Hardware_waitForTrigger(Hardware *my, void *partEvt)
 {
-#if 1
+#if 0
        struct timespec tS, *t = &tS;
 
        t->tv_sec = 0;
index c3d30da58fbe16784ba6a438ce48d4a79c9581f9..9ff88e09b012fea0e5ef03bf34a612c354733309 100644 (file)
@@ -29,22 +29,22 @@ set sam5(cardbase) 0xcC000000
 set sam6(cardbase) 0xdC000000
 set sam7(cardbase) 0xeC000000
 set sam8(cardbase) 0x5C000000
-set soft(size) 1024
+set soft(size) 8192
 
 set dtu(cardbase) 0x44100000
 
-set ipc0(ipc_vmebase) 0x100000
-set ipc1(ipc_vmebase) 0x200000
-set ipc2(ipc_vmebase) 0x300000
-set ipc3(ipc_vmebase) 0x400000
-set ipc4(ipc_vmebase) 0x500000
-set ipc5(ipc_vmebase) 0x600000
-set ipc6(ipc_vmebase) 0x700000
-set ipc7(ipc_vmebase) 0x800000
-set ipc8(ipc_vmebase) 0x900000
-set ipc9(ipc_vmebase) 0xa00000
-set ipc10(ipc_vmebase) 0xb00000
-set ipc11(ipc_vmebase) 0xc00000
+set ipc0(cardbase) 0x100000
+set ipc1(cardbase) 0x200000
+set ipc2(cardbase) 0x300000
+set ipc3(cardbase) 0x400000
+set ipc4(cardbase) 0x500000
+set ipc5(cardbase) 0x600000
+set ipc6(cardbase) 0x700000
+set ipc7(cardbase) 0x800000
+set ipc8(cardbase) 0x900000
+set ipc9(cardbase) 0xa00000
+set ipc10(cardbase) 0xb00000
+set ipc11(cardbase) 0xc00000
 
 set race0(cardbase) 0x00000000
 set race1(cardbase) 0x10000000