Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 12 → Rev 15

/pts/wienvme_dll.c
70,7 → 70,7
int result;
 
/* close the opened path */
printf("VME_Close at addr=%d\n",hHandle);
//printf("VME_Close at addr=%d\n",hHandle);
result = VMEclose(hHandle);
if (result) {
/pts/Makefile
13,13 → 13,6
DBG =
CFLAGS = $(DBG) $(INC) -fPIC -DLINUX -Wall
 
 
TARGET = daq
 
FILES = $(SRC)/daq.C
 
VMELIB = libf9vme.a
 
SHLIB = -lpcivme -lz
 
OBJ_FILES = PtsModule.o
53,23 → 46,13
$(CXX) -c $(CFLAGS) $<
ar r $(VMELIB) $@
 
vme: $(OBJ_FILES)
 
 
 
VMEModule.o: VMEModule.hh VMEModule.cc
 
CAENV965.o: CAENV965.h CAENV965_DEF.h CAENV965.c
 
 
$(TARGET): $(FILES) $(OBJ_FILES)
$(CXX) -DMAIN $(CFLAGS) $(FILES) $(OBJ_FILES) $(SHLIB) -o $(TARGET)
 
 
 
clean:
rm Dict.C libdaq.so $(TARGET1)
rm pts
 
 
tgz:
tar czvf vme.tgz Makefile *.c *.h *.C *.cc *.hh
tar czvf pts.tgz Makefile *.c *.h *.C *.cc *.hh
/pts/PtsModule.c
7,6 → 7,7
#include <unistd.h>
#include <string.h>
#include "PtsModule.h"
#include <getopt.h>
 
void Delay(double t){
usleep(t*1e6);
188,19 → 189,45
 
void help(char *argv){
printf("Usage: %s -a <ptsaddr> -v <verbose> -c .... Pts_check_configure\n", argv);
printf("Usage: %s -a <ptsaddr> -v <verbose> -i <filename> -b mode ... Pts_configure_bit\n", argv);
printf("Usage: %s -a <ptsaddr> -v <verbose> -i <filename> -b mode (2) ... Pts_configure_bit\n", argv);
printf("Usage: %s -a <ptsaddr> -v <verbose> -e .... Pts_erase\n", argv);
printf("Usage: %s -a <ptsaddr> -v <verbose> -r .... Pts_reset\n", argv);
printf("Usage: %s -a <ptsaddr> -v <verbose> -w <value> .... Pts_write_csr\n", argv);
printf("Usage: %s -a <ptsaddr> -v <verbose> -x .... Pts_reset\n", argv);
printf("Usage: %s -a <ptsaddr> -v <verbose> -c .... Pts_check_configure\n", argv);
printf("Usage: %s -a <ptsaddr> -v <verbose> -r .... vme read\n", argv);
printf("Usage: %s -a <ptsaddr> -v <verbose> -w <value> .... vme write\n", argv);
printf("Usage: %s -a <ptsaddr> -v <verbose> -s <value> .... Pts_write_csr\n", argv);
printf("Example: %s --address 0x1000000 --verbose 1 --erase\n", argv);
printf("Example: %s --address 0x1000000 --verbose 1 --input pts_scaler.bit --load-bit 2\n", argv);
printf("Example: %s --address 0x1000004 --write-csr 0x7600\n", argv);
}
 
 
 
static const char *optString = "v:rxea:cs:w:i:b:h";
static const struct option longOpts[] = {
{ "verbose", required_argument, NULL, 'v' },
{ "reset" , no_argument, NULL, 'x' },
{ "erase" , no_argument, NULL, 'e' },
{ "address", required_argument, NULL, 'a' },
{ "check-configure", no_argument, NULL, 'c' },
{ "write-csr", required_argument , NULL, 's' },
{ "input", required_argument , NULL, 'i' },
{ "load-bit", required_argument , NULL, 'b' },
{ "read", no_argument , NULL, 'r' },
{ "write",required_argument , NULL, 'w' },
{ "help", no_argument, NULL, 'h' },
{ NULL, no_argument, NULL, 0 }
};
 
int main (int argc, char ** argv){
unsigned long value;
 
uint32_t value;
 
int verbose=0;
char filename[256]="file.bit";
int c;
opterr = 0;
int longIndex = 0;
 
if (argc<2) {
help(argv[0]);
208,13 → 235,18
}
 
VME_START(NULL);
while ((c = getopt (argc, argv, "v:rea:cw:i:b:h")) != -1)
 
c = getopt_long( argc, argv, optString, longOpts, &longIndex );
while( c != -1 )
 
// while ((c = getopt (argc, argv, "v:xrea:csw:i:b:h")) != -1)
{
switch (c)
{
case 'v':
verbose = atoi(optarg);
break;
case 'r':
case 'x':
Pts_reset(verbose);
break; // reset
case 'e':
228,6 → 260,14
break;
case 'w':
value = strtoul (optarg,NULL,0);
Pts_write( 0 , value );
break;
case 'r':
value = 0;
Pts_read( 0 , &value );
break;
case 's':
value = strtoul (optarg,NULL,0);
Pts_write_csr( verbose, value );
break;
case 'i':
245,6 → 285,8
default:
printf("Unknown command %c\n",c);
}
c = getopt_long( argc, argv, optString, longOpts, &longIndex );
}
VME_STOP();
}