diff --git a/debian/changelog b/debian/changelog index 1f7fd04513d5e9def8b974f21cb00b46f5db0635..03288594fec9747d4f43ac22afe40e2d9c7c61fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +advligorts (5.0.0~dev3+deb11-2) unstable; urgency=medium + + * Merge of master, rts models using logger module + * Fixing gpstime dkms build with logger changes + + -- EJ <ezekiel.dohmen@ligo.org> Tue, 05 Jul 2022 15:28:59 -0700 + advligorts (5.0.0~dev2+deb11-1) unstable; urgency=medium * Merge of master for new dev release diff --git a/debian/rules b/debian/rules index 4f8fc8c0a1a335e622ce0c71fcdf512dc66869c2..4eb6343e1941e31393115de46fe782fadc089925 100755 --- a/debian/rules +++ b/debian/rules @@ -23,6 +23,7 @@ install-gpstime: dh_installdirs -padvligorts-gpstime-dkms usr/src/gpstime-$(SVERSION)/drv/gpstime dh_installdirs -padvligorts-gpstime-dkms usr/src/gpstime-$(SVERSION)/include/drv dh_installdirs -padvligorts-gpstime-dkms usr/src/gpstime-$(SVERSION)/include/util + dh_installdirs -padvligorts-gpstime-dkms usr/src/gpstime-$(SVERSION)/drv/rts-logger/force-printk/ dh_installdirs -padvligorts-gpstime-dkms lib/udev/rules.d dh_installdirs -padvligorts-gpstime-dkms usr/lib/modules-load.d dh_installdirs -padvligorts-gpstime-dkms usr/share/advligorts @@ -33,6 +34,7 @@ install-gpstime: install --mode=644 -t debian/advligorts-gpstime-dkms/usr/src/gpstime-$(SVERSION)/include/util src/include/util/*.h install --mode=644 -t debian/advligorts-gpstime-dkms/usr/src/gpstime-$(SVERSION)/include/ src/include/proc.h install --mode=644 -t debian/advligorts-gpstime-dkms/usr/src/gpstime-$(SVERSION)/include/ src/include/portableInline.h + install --mode=644 -t debian/advligorts-gpstime-dkms/usr/src/gpstime-$(SVERSION)/drv/rts-logger/force-printk/ src/drv/rts-logger/force-printk/printk-rts-logger.c install --mode=755 -t debian/advligorts-gpstime-dkms/usr/src/gpstime-$(SVERSION) support/bin/dkms_install_files sed 's|__SHARE__|/usr/share/advligorts|' <support/udev/gpstime.rules >debian/advligorts-gpstime-dkms/lib/udev/rules.d/60-gpstime.rules echo gpstime > debian/advligorts-gpstime-dkms/usr/lib/modules-load.d/gpstime.conf diff --git a/src/drv/gpstime/Makefile b/src/drv/gpstime/Makefile index ad71dbc77f4686daa925ae5217816ddeed70d848..5bfc13e9d373cda3d333d37634411a5eab389dd1 100644 --- a/src/drv/gpstime/Makefile +++ b/src/drv/gpstime/Makefile @@ -33,8 +33,9 @@ $(MODULENAME)-y := $(MODULENAME)_core.o $(MODULENAME)-y += ../../include/drv/spectracomGPS.o $(MODULENAME)-y += ../../include/drv/symmetricomGps.o $(MODULENAME)-y += ../../include/drv/ligoPcieTiming_core.o +$(MODULENAME)-y += ../../drv/rts-logger/force-printk/printk-rts-logger.o -ccflags-y += -I$(mkfile_dir)/../../include/ +ccflags-y += -DRTS_LOG_PREFIX=\"gpstime\" -I$(mkfile_dir)/../../include/ ifeq ($(KERNELRELEASE),) all: diff --git a/src/drv/gpstime/gpstime_core.c b/src/drv/gpstime/gpstime_core.c index 8574f9f674bdcc99664b41295251bdd18d7c965c..ebcd494efbc8f551257b7dbe3752197af524c8fd 100644 --- a/src/drv/gpstime/gpstime_core.c +++ b/src/drv/gpstime/gpstime_core.c @@ -47,9 +47,6 @@ CDS_HARDWARE cdsPciModules; #include "drv/spectracomGPS.h" #include "drv/symmetricomGps.h" #include "drv/ligoPcieTiming.h" -//#include "../../include/drv/spectracomGPS.c" -//#include "../../include/drv/symmetricomGps.c" -//#include "../../include/drv/ligoPcieTiming_core.c" #define CDS_LOCAL_GPS_BUFFER_SIZE 30 diff --git a/src/drv/rts-logger/README.md b/src/drv/rts-logger/README.md index ab9a5981718c65047f73bb8db9834543e49f6894..c7520caaebc092c255ead7f80185a7de20ca7701 100644 --- a/src/drv/rts-logger/README.md +++ b/src/drv/rts-logger/README.md @@ -41,9 +41,11 @@ sudo journalctl -t kernel -f | grep x1tst # Structure ``` -include/ # Contains shared header file that other modules would use for logger declarations. -module/ # Main logger module implementation. -test/ # Test module that spams the logger from a couple of threads. -userspace/ # Userspace implementation for the logger +force-printk/ # Version that uses printk for logger methods (used by gpstime) +module/ # Main logger module implementation. +test/ # Test module that spams the logger from a couple of threads. +userspace/ # Userspace implementation for the logger ``` +## Other Notes +Because the `gpstime` module includes some timing card c files that use RTSLOG functions we provide a printk version for building with `gpstime`. diff --git a/src/drv/rts-logger/force-printk/printk-rts-logger.c b/src/drv/rts-logger/force-printk/printk-rts-logger.c new file mode 100644 index 0000000000000000000000000000000000000000..4da2a09a95dcaee0cd270c6ea144782efd9cb91d --- /dev/null +++ b/src/drv/rts-logger/force-printk/printk-rts-logger.c @@ -0,0 +1,47 @@ +#include "drv/rts-logger.h" + +#include <linux/printk.h> +#include <linux/atomic.h> + +static atomic_t g_log_level = ATOMIC_INIT( RTSLOG_LOG_LEVEL_INFO ); + + +void rtslog_print(int level, const char * fmt, ...) +{ + va_list args; + + if(level < rtslog_get_log_level() ) return; + + va_start(args, fmt); + + vprintk(fmt, args); + + va_end(args); + +} + +int rtslog_set_log_level(int new_level) +{ + if(new_level < RTSLOG_LOG_LEVEL_DEBUG || new_level > RTSLOG_LOG_LEVEL_ERROR) return 0; + + atomic_set(&g_log_level, new_level); + return 1; + +} + +int rtslog_get_log_level( void ) +{ + return atomic_read(&g_log_level); +} + + +int rtslog_get_num_dropped_space ( void ) +{ + return 0; +} + +int rtslog_get_num_ready_to_print( void ) +{ + return 0; +} + diff --git a/src/epics/util/Makefile.in b/src/epics/util/Makefile.in index c8c9031e52eece334f6e638522a9d11364a61131..22fc8c0b5a2f95f1db3a171c75f6a196f7d9cc6b 100644 --- a/src/epics/util/Makefile.in +++ b/src/epics/util/Makefile.in @@ -32,8 +32,17 @@ endif ifndef RTS_CPU_ISOLATOR_SYM RTS_CPU_ISOLATOR_SYM := $(shell $(srcdir)/find_module_symvers -q rts-cpu-isolator) endif +ifndef RTS_LOGGER_SYM +RTS_LOGGER_SYM := $(shell $(srcdir)/find_module_symvers -q rts-logger) +endif %: - env RCG_SRC_DIR=$(top_srcdir) PERL5LIB=$(srcdir) MBUF_SYM=$(MBUF_SYM) GPSTIME_SYM=$(GPSTIME_SYM) RTS_CPU_ISOLATOR_SYM=$(RTS_CPU_ISOLATOR_SYM) $(srcdir)/feCodeGen.pl $@.mdl $@ + env RCG_SRC_DIR=$(top_srcdir) \ + PERL5LIB=$(srcdir) \ + MBUF_SYM=$(MBUF_SYM) \ + GPSTIME_SYM=$(GPSTIME_SYM) \ + RTS_CPU_ISOLATOR_SYM=$(RTS_CPU_ISOLATOR_SYM) \ + RTS_LOGGER_SYM=$(RTS_LOGGER_SYM) \ + $(srcdir)/feCodeGen.pl $@.mdl $@ all: diff --git a/src/epics/util/Userspace_CMakeLists.cmake b/src/epics/util/Userspace_CMakeLists.cmake index 5fd1b234a4b5378dab5886c9582e5bc2f33bf0d3..d1272bbca70dc5eec85fdf0062e4d35eba98d97d 100644 --- a/src/epics/util/Userspace_CMakeLists.cmake +++ b/src/epics/util/Userspace_CMakeLists.cmake @@ -18,6 +18,10 @@ set(LIB_NAME lib${MODEL_NAME}) # Include generated FLAGS, options and INC dirs. include(${CMAKE_CURRENT_SOURCE_DIR}/UserspaceVars.cmake) +if(${LIGO_INLINE}) + list(APPEND CFLAGS "-DLIGO_INLINE=${LIGO_INLINE}") +endif() + if(${USE_STDLIB_MATH}) list(APPEND CFLAGS "-DUSE_STDLIB_MATH=1") endif() @@ -43,7 +47,8 @@ list(APPEND COMMON_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/${MODEL_NAME}_core.c" "${CMAKE_CURRENT_SOURCE_DIR}/src/include/drv/daqLib.c" "${CMAKE_CURRENT_SOURCE_DIR}/src/fe/rcguserCommon.c" "${CMAKE_CURRENT_SOURCE_DIR}/src/fe/commDataUsp.c" - "${CMAKE_CURRENT_SOURCE_DIR}/src/drv/shmem.c") + "${CMAKE_CURRENT_SOURCE_DIR}/src/drv/shmem.c" + "${CMAKE_CURRENT_SOURCE_DIR}/src/drv/rts-logger/userspace/usp-rts-logger.c") if(BUILD_USP_GPSCLOCK) diff --git a/src/epics/util/feCodeGen.pl b/src/epics/util/feCodeGen.pl index d66d729b0a1889245b9fefc368a5cb789201dd77..87c6e912494f7828e3ef66ec69a5ad7f45fd5cfa 100755 --- a/src/epics/util/feCodeGen.pl +++ b/src/epics/util/feCodeGen.pl @@ -29,6 +29,19 @@ require "lib/Dac20.pm"; #// #// Remaining arguments listed in code are optional and not normally used by RCG Makefile. \n\n +#// Environment Vars +#// Required: +#// RCG_SRC_DIR : The current advligorts src directory that shoudl be used by the build. This is set +#// by the top level Makefile when calling rtcds build. +#// PERL5LIB : This is set by the top level Makefile so that these scrips can find cdsParts +#// +#// Optional: +#// SIMULATION_BUILD : Warning this should not be set in production systems. This argument enables the generation +#// of IPC entries from IPC RECEIVER parts. This is used by librts so it can build models +#// with IPC receivers, that have senders from other models. +#// +#// + # Normal call from Makefile is just first two args. #// @@ -73,6 +86,7 @@ $rcg_src_dir = $ENV{"RCG_SRC_DIR"}; $mbufsymfile = $ENV{"MBUF_SYM"}; $gpssymfile = $ENV{"GPSTIME_SYM"}; $cpuisolatorfile = $ENV{"RTS_CPU_ISOLATOR_SYM"}; +$rtsloggerfile = $ENV{"RTS_LOGGER_SYM"}; $dolphinGen = 2; if (! length $rcg_src_dir) { $rcg_src_dir = "$currWorkDir/../../.."; } @@ -362,6 +376,19 @@ for ($ii = 0; $ii < $partCnt; $ii++) { #// - Process all IPC parts in one go. Requires <em>lib/IPCx.pm</em>, with call to procIpc. \n require "lib/IPCx.pm"; ("CDS::IPCx::procIpc") -> ($partCnt); +if(defined $ENV{'SIMULATION_BUILD'}) +{ + # When in simulation build receivers are added to the IPC file + # But we need to reprocess so we can load their info + $ipcxCnt = 0; # === IPCx === + $ipcxDeclDone = 0; # === IPCx === + $ipcxInitDone = 0; # === IPCx === + $ipcxBlockTags[0] = undef; + $ipcxParts[0][0] = undef; + $ipcxTagCount = 0; + $ipcxReset = ""; + ("CDS::IPCx::procIpc") -> ($partCnt); +} #// - Check that all subsystem INPUT parts are connected; else exit w/error. \n @@ -731,16 +758,50 @@ for($ii=0;$ii<$nonSubCnt;$ii++) } } -#// - Remove all parts which will not require further processing in the code for the part -#// total. \n +#// - Remove all parts which will not require further processing in the code for the part +#// total, also do a part check for blocks with different capitalization that are going to +#// emit c code that will be lowercased (causing collisions) $ftotal = $partCnt; - for($kk=0;$kk<$partCnt;$kk++) - { - if(($partType[$kk] eq "INPUT") || ($partType[$kk] eq "OUTPUT") || ($partType[$kk] eq "BUSC") || ($partType[$kk] eq "BUSS") || ($partType[$kk] eq "EpicsIn") || ($partType[$kk] eq "TERM") || ($partType[$kk] eq "FROM") || ($partType[$kk] eq "GOTO") || ($partType[$kk] eq "GROUND") || ($partType[$kk] eq "CONSTANT") || ($partType[$kk] eq "Adc") || ($partType[$kk] eq "Gps") || ($partType[$kk] eq "StateWord") || ($partType[$kk] eq "ModelRate") || ($partType[$kk] eq "EXC")) - { - $ftotal --; - } - } + +my %seen; #Hash that keeps track of the names we have seen before +my %noCode = map {$_ => 1} qw(INPUT OUTPUT BUSC BUSS FROM GOTO); #Hash of non-generating parts +my @duplicates = (); + +for($kk=0;$kk<$partCnt;$kk++) +{ + if(($partType[$kk] eq "INPUT") || ($partType[$kk] eq "OUTPUT") || ($partType[$kk] eq "BUSC") + || ($partType[$kk] eq "BUSS") || ($partType[$kk] eq "EpicsIn") || ($partType[$kk] eq "TERM") + || ($partType[$kk] eq "FROM") || ($partType[$kk] eq "GOTO") || ($partType[$kk] eq "GROUND") + || ($partType[$kk] eq "CONSTANT") || ($partType[$kk] eq "Adc") || ($partType[$kk] eq "Gps") + || ($partType[$kk] eq "StateWord") || ($partType[$kk] eq "ModelRate") || ($partType[$kk] eq "EXC")) + { + $ftotal --; + } + + # Check to see if we have a part with the same lower case name, + # and neither parts are of a no code generating type + if ( exists $seen{ lc $xpartName[$kk] } + and not exists $noCode{$partType[$kk]} + and not exists $noCode{ $seen{ lc $xpartName[$kk] }[1] } ) + { + push(@duplicates, "\tFirst (part, type) is: ($xpartName[$kk], $partType[$kk]),". + " other part is ($seen{ lc $xpartName[$kk]}[0], $seen{ lc $xpartName[$kk]}[1])\n"); + } + else + { + my @val = ($xpartName[$kk], $partType[$kk]); + $seen{ lc $xpartName[$kk] } = \@val; + } +} + +if ( scalar(@duplicates) > 0) #If we found 1 or more issues +{ + my $whole_error = "ERROR - Some part(s) failed the duplicate name check. " . + "Two parts, that generate code, with the same name (but different capitalization) were found.\n" . + "This can cause an issue with code generation, please rename one of the parts, from each pair.\n"; + $whole_error = $whole_error . join('', @duplicates); + die $whole_error . "\n"; +} print "Total parts to process $ftotal\n"; @@ -1173,6 +1234,19 @@ print OUTH "#include \"drv/cdsHardware.h\"\n"; $totalCardCount = $adcCnt + $dacCnt + $boCnt; print OUTH "extern CDS_CARDS cards_used[" . $totalCardCount . "];\n\n"; +print OUTH "#include \"commData3.h\"\n"; +print OUTH "#define MODEL_NUM_IPCS_USED $::ipcxCnt\n"; +if ( $::ipcxCnt == 0) +{ + print OUTH "extern CDS_IPC_INFO ipcInfo[1];\n\n"; +} +else +{ + print OUTH "extern CDS_IPC_INFO ipcInfo[$::ipcxCnt];\n\n"; +} + + + print OUTH "typedef struct CDS_EPICS_IN {\n"; print OUTH "\tint vmeReset;\n"; print EPICS "MOMENTARY FEC\_$dcuId\_VME_RESET epicsInput.vmeReset int ao 0\n"; @@ -1891,7 +1965,6 @@ close OUT; close OUTD; -close WARNINGS; #// Write out the User Space Code Here (Just copy it, same code file for both) copy("./".$modelCodeKernFilepath, "./".$modelCodeUspFilepath) or die "copy failed: $! : "; @@ -2274,17 +2347,29 @@ for($ii=0;$ii<$dacCnt;$ii++) # ****************************************************************************************** #// - GENERATE caQtDM SCREENS -opendir my $dh, $epicsScreensDir; -while (my $cf = readdir $dh) { - if($cf =~ m/.adl/) { - my ($fbase,$fext) = split '\.',$cf; - system("cp $epicsScreensDir/$cf ." ); - $ui_output = "$caqtdmScreensDir/$fbase" . ".ui"; - system("adl2ui $cf"); - system("cp $fbase.ui $ui_output"); - system("rm $fbase.ui $cf"); - } + +if ( system("adl2ui -h") == 0 ) +{ + + opendir my $dh, $epicsScreensDir; + while (my $cf = readdir $dh) { + if($cf =~ m/.adl/) { + my ($fbase,$fext) = split '\.',$cf; + system("cp $epicsScreensDir/$cf ." ); + $ui_output = "$caqtdmScreensDir/$fbase" . ".ui"; + system("adl2ui $cf"); + system("cp $fbase.ui $ui_output"); + system("rm $fbase.ui $cf"); + } + } } +else #No caQtDM installed skip +{ + print WARNINGS "\ncaqtdm is not installed, skipping caQtDM screen generation.\n\n"; +} + +close WARNINGS; + #// - Print source file names into a file # diff --git a/src/epics/util/lib/Filt.pm b/src/epics/util/lib/Filt.pm index 815fefa0dde7301836ddbeea32d35a47acdf8fb2..52dcb44f2746ab88149bdc079b8933f6cefbf7fa 100644 --- a/src/epics/util/lib/Filt.pm +++ b/src/epics/util/lib/Filt.pm @@ -80,6 +80,13 @@ sub frontEndCode { my ($i) = @_; my $calcExp = "// FILTER MODULE"; if ($::ppFIR[$i] == 1) { + + if ( $::modelrate ne 2 and $::modelrate ne 4 ) + { + die ("Error - The model has a FIR filter in it but has a rate of " . $::modelrate . + "K, only 2K and 4K models support FIR filters."); + } + $calcExp .= " (PolyPhase FIR)"; } $calcExp .= ": $::xpartName[$i]\n"; diff --git a/src/epics/util/lib/IPCx.pm b/src/epics/util/lib/IPCx.pm index 7230da1f4238f336c2c12047e0b3ee0f99f504bf..bc283610eb945dcb8aef8abcf7b6447dad74efac 100644 --- a/src/epics/util/lib/IPCx.pm +++ b/src/epics/util/lib/IPCx.pm @@ -110,7 +110,7 @@ sub printFrontEndVars { print ::OUT "#define COMMDATA_INLINE\n"; print ::OUT "#include \"commData3.h\"\n"; print ::OUT "static int myIpcCount;\n"; - print ::OUT "static CDS_IPC_INFO ipcInfo[$::ipcxCnt];\n\n"; + print ::OUT "CDS_IPC_INFO ipcInfo[$::ipcxCnt];\n\n"; } } @@ -144,7 +144,7 @@ sub frontEndInitCode { for ($l = 0; $l < $::ipcxCnt; $l++) { if ($::ipcxParts[$l][6] == $i) { $found = 1; - + if ( ($::ipcxParts[$l][7] =~ /^Ground/) || ($::ipcxParts[$l][7] =~ /\_Ground/) ) { $calcExp .= "ipcInfo[$::ipcxInitDone]\.mode = IRCV;\n"; } @@ -570,8 +570,16 @@ $ipcxRcvrCnt = 0; $kk = $::ipcxParts[$ii][6]; if ( ($::partInput[$kk][0] =~ /^Ground/) || ($::partInput[$kk][0] =~ /\_Ground/) ) { - $ipcxAdd[$ipcxNotFound][1] = 2; - $ipcxRcvrCnt++; + + if(defined $ENV{'SIMULATION_BUILD'}) + { + $ipcxAdd[$ipcxNotFound][1] = 1; + } + else + { + $ipcxAdd[$ipcxNotFound][1] = 2; + $ipcxRcvrCnt++; + } } else { if ($::partOutCnt[$kk] != 0) { @@ -665,6 +673,7 @@ $ipcxRcvrCnt = 0; $::ipcxParts[$ipcxAdd[$jj][0]][3] = $::targetHost; $::ipcxParts[$ipcxAdd[$jj][0]][4] = $ipcxMaxNum[$ipcxTypeIndex]; $::ipcxParts[$ipcxAdd[$jj][0]][5] = $::skeleton; + $::ipcxParts[$ipcxAdd[$jj][0]][9] = 1; #Because we are adding this, it must be a sender IPC $ipcxNew++; } diff --git a/src/epics/util/lib/createKernelModuleBuildEnv.pm b/src/epics/util/lib/createKernelModuleBuildEnv.pm index 7c9afd34d48cb094dd3b1e41661a70f8133e3f66..aec102548d59badbe5c5dff907d4ffbf42a351bd 100644 --- a/src/epics/util/lib/createKernelModuleBuildEnv.pm +++ b/src/epics/util/lib/createKernelModuleBuildEnv.pm @@ -35,6 +35,7 @@ if ($::virtualiop != 1) { print OUTM "KBUILD_EXTRA_SYMBOLS = $::mbufsymfile\n"; print OUTM "KBUILD_EXTRA_SYMBOLS += $::gpssymfile\n"; print OUTM "KBUILD_EXTRA_SYMBOLS += $::cpuisolatorfile\n"; +print OUTM "KBUILD_EXTRA_SYMBOLS += $::rtsloggerfile\n"; #if ($::iopModel == -1) { #Not IOP model - Leaving this in (for now) so we can inject symbols we want by editing the symvers file print OUTM "KBUILD_EXTRA_SYMBOLS += \$(mkfile_dir)/../../ModuleIOP.symvers\n"; diff --git a/src/fe/commData3.c b/src/fe/commData3.c index 8c170569715da53cb38bc23595f81739dff057b6..7808fa7e8c704d902058277f557cfaac52a82d57 100644 --- a/src/fe/commData3.c +++ b/src/fe/commData3.c @@ -19,6 +19,7 @@ ///< for more details. #include "commData3.h" #include "controller.h" //cdsPciModules, _shmipc_shm +#include "drv/rts-logger.h" #include <asm/cacheflush.h> @@ -39,14 +40,17 @@ commData3Init( //Set ipcMemOffset to default value, will re-set below unsigned long ipcMemOffset = IPC_PCIE_BASE_OFFSET + RFM0_OFFSET; -// printl("size of data block = 0x%x\n", sizeof(CDS_IPC_COMMS)); -// printl("Dolphin num = %d \n",cdsPciModules.dolphinCount); -// printl("\tLocal at 0x%x and 0x%x -// \n",cdsPciModules.dolphinRead[0],cdsPciModules.dolphinWrite[0]); -// printl("\tRFM at 0x%x and 0x%x -// \n",cdsPciModules.dolphinRead[1],cdsPciModules.dolphinWrite[1]); + //RTSLOG_DEBUG("size of data block = 0x%x\n", sizeof(CDS_IPC_COMMS)); + //RTSLOG_DEBUG("Dolphin num = %d \n",cdsPciModules.dolphinCount); + //RTSLOG_DEBUG("\tLocal at 0x%x and 0x%x\n", + // cdsPciModules.dolphinRead[0], + // cdsPciModules.dolphinWrite[0]); + //RTSLOG_DEBUG("\tRFM at 0x%x and 0x%x\n", + // cdsPciModules.dolphinRead[1], + // cdsPciModules.dolphinWrite[1]); + #ifdef RFM_DELAY -// printl("Model compiled with RFM DELAY !!\n"); +// RTSLOG_DEBUG("Model compiled with RFM DELAY !!\n"); #endif for ( ii = 0; ii < connects; ii++ ) { @@ -133,18 +137,18 @@ commData3Init( (CDS_IPC_COMMS*)( (volatile char*)( cdsPciModules .dolphinWrite[ 0 ] ) + IPC_PCIE_BASE_OFFSET ); - // printl("Net Type = PCIE SEND IPC at 0x%p + // RTSLOG_DEBUG("Net Type = PCIE SEND IPC at 0x%p // *********************************\n",ipcInfo[ii].pIpcData); } #if 0 // Following for diags, if desired. Otherwise, leave out as it fills dmesg if(ipcInfo[ii].mode == ISND && ipcInfo[ii].netType != ISHME) { - printl("IPC Number = %d\n",ipcInfo[ii].ipcNum); - printl("IPC Name = %s\n",ipcInfo[ii].name); - printl("Sender Model Name = %s\n",ipcInfo[ii].senderModelName); - printl("RCV Rate = %d\n",ipcInfo[ii].rcvRate); - printl("Send Computer Number = %d\n",ipcInfo[ii].sendNode); - printl("Send address = %lx\n",(unsigned long)&ipcInfo[ii].pIpcDataWrite[0]->dBlock[0][ipcInfo[ii].ipcNum].data); + RTSLOG_DEBUG("IPC Number = %d\n",ipcInfo[ii].ipcNum); + RTSLOG_DEBUG("IPC Name = %s\n",ipcInfo[ii].name); + RTSLOG_DEBUG("Sender Model Name = %s\n",ipcInfo[ii].senderModelName); + RTSLOG_DEBUG("RCV Rate = %d\n",ipcInfo[ii].rcvRate); + RTSLOG_DEBUG("Send Computer Number = %d\n",ipcInfo[ii].sendNode); + RTSLOG_DEBUG("Send address = %lx\n",(unsigned long)&ipcInfo[ii].pIpcDataWrite[0]->dBlock[0][ipcInfo[ii].ipcNum].data); } #endif } @@ -153,7 +157,7 @@ commData3Init( { if ( ipcInfo[ ii ].mode == ISND && ipcInfo[ ii ].netType != ISHME ) { - // printl("IPC Name = %s + // RTSLOG_DEBUG("IPC Name = %s // \t%d\t%d\t%lx\t%lx\n",ipcInfo[ii].name,ipcInfo[ii].netType,ipcInfo[ii].ipcNum, // (unsigned // long)&ipcInfo[ii].pIpcDataWrite[0]->dBlock[0][ipcInfo[ii].ipcNum].data, diff --git a/src/fe/commDataUsp.c b/src/fe/commDataUsp.c index 376d710eb5b1ae7c708c25af5975d4fb8884d2de..4bd1ebebdd571dc47c23b700c5baa1bc07713e1b 100644 --- a/src/fe/commDataUsp.c +++ b/src/fe/commDataUsp.c @@ -20,7 +20,7 @@ #include "commData3.h" #include "controller.h" -#include "util/printl.h" +#include "drv/rts-logger.h" #ifdef DOLPHIN_TEST #include "sisci_types.h" @@ -49,14 +49,14 @@ commData3Init( int ii; unsigned long ipcMemOffset; -// printl("size of data block = 0x%x\n", sizeof(CDS_IPC_COMMS)); -// printl("Dolphin num = %d \n",cdsPciModules.dolphinCount); -// printl("\tLocal at 0x%x and 0x%x +// RTSLOG_DEBUG("size of data block = 0x%x\n", sizeof(CDS_IPC_COMMS)); +// RTSLOG_DEBUG("Dolphin num = %d \n",cdsPciModules.dolphinCount); +// RTSLOG_DEBUG("\tLocal at 0x%x and 0x%x // \n",cdsPciModules.dolphinRead[0],cdsPciModules.dolphinWrite[0]); -// printl("\tRFM at 0x%x and 0x%x +// RTSLOG_DEBUG("\tRFM at 0x%x and 0x%x // \n",cdsPciModules.dolphinRead[1],cdsPciModules.dolphinWrite[1]); #ifdef RFM_DELAY -// printl("Model compiled with RFM DELAY !!\n"); +// RTSLOG_INFO("Model compiled with RFM DELAY !!\n"); #endif for ( ii = 0; ii < connects; ii++ ) { @@ -142,19 +142,19 @@ commData3Init( (CDS_IPC_COMMS*)( (volatile char*)( cdsPciModules .dolphinWrite[ 0 ] ) + IPC_PCIE_BASE_OFFSET ); - // printl("Net Type = PCIE SEND IPC at 0x%p + // RTSLOG_INFO("Net Type = PCIE SEND IPC at 0x%p // *********************************\n",ipcInfo[ii].pIpcData); } // Following for diags, if desired. Otherwise, leave out as it fills dmesg // if(ipcInfo[ii].mode == ISND && ipcInfo[ii].netType != ISHME) { if(ipcInfo[ii].mode == ISND) { - printl("IPC Number = %d\n",ipcInfo[ii].ipcNum); - printl("IPC Name = %s\n",ipcInfo[ii].name); - printl("Sender Model Name = %s\n",ipcInfo[ii].senderModelName); - printl("IPC Net = %d\n",ipcInfo[ii].netType); - printl("Send Computer Number = %d\n",ipcInfo[ii].sendNode); - printl("Send address = %lx\n",(unsigned long)&ipcInfo[ii].pIpcDataWrite[0]->dBlock[0][ipcInfo[ii].ipcNum].data); - printl("*******************\n"); + RTSLOG_INFO("IPC Number = %d\n",ipcInfo[ii].ipcNum); + RTSLOG_INFO("IPC Name = %s\n",ipcInfo[ii].name); + RTSLOG_INFO("Sender Model Name = %s\n",ipcInfo[ii].senderModelName); + RTSLOG_INFO("IPC Net = %d\n",ipcInfo[ii].netType); + RTSLOG_INFO("Send Computer Number = %d\n",ipcInfo[ii].sendNode); + RTSLOG_INFO("Send address = %lx\n",(unsigned long)&ipcInfo[ii].pIpcDataWrite[0]->dBlock[0][ipcInfo[ii].ipcNum].data); + RTSLOG_INFO("*******************\n"); } } // Send connection list to dmesg @@ -162,7 +162,7 @@ commData3Init( { if ( ipcInfo[ ii ].mode == ISND && ipcInfo[ ii ].netType != ISHME ) { - // printl("IPC Name = %s + // RTSLOG_INFO("IPC Name = %s // \t%d\t%d\t%lx\t%lx\n",ipcInfo[ii].name,ipcInfo[ii].netType,ipcInfo[ii].ipcNum, // (unsigned // long)&ipcInfo[ii].pIpcDataWrite[0]->dBlock[0][ipcInfo[ii].ipcNum].data, @@ -381,7 +381,7 @@ commData3Receive( else { ipcInfo[ ii ].errFlag++; - // printl("bad IPC %ld %ld\n", syncWord, mySyncWord); + // RTSLOG_ERROR("bad IPC %ld %ld\n", syncWord, mySyncWord); } } else diff --git a/src/fe/controllerApp.c b/src/fe/controllerApp.c index b18a103b44bb1faf8be7698081968bdd40a0c82d..b26e35f9e895352fcf0138f515fa31e017cb697d 100644 --- a/src/fe/controllerApp.c +++ b/src/fe/controllerApp.c @@ -35,7 +35,6 @@ #include "feComms.h" #include "modelRateInfo.h" #include "fm10Gen.h" -#include "util/printl.h" #include "util/kernel/exit_signaling.h" #include "../fe/timing_common.h" //captureEocTiming #include "../fe/timing_kernel.h" @@ -204,6 +203,7 @@ fe_start_controller( void ) if ( initVars( pDsp[ 0 ], pDsp[ 0 ], dspCoeff, MAX_MODULES, pCoeff[ 0 ] ) ) { pLocalEpics->epicsOutput.fe_status = FILT_INIT_ERROR; + RTSLOG_ERROR("Failed to initialize filter banks, waiting for an exit signal.\n"); wait_for_exit_signal(); atomic_set(&g_atom_has_exited, 1); return; @@ -244,6 +244,7 @@ fe_start_controller( void ) if ( status == -1 ) { pLocalEpics->epicsOutput.fe_status = DAQ_INIT_ERROR; + RTSLOG_ERROR("Failed to initialize DAQ, waiting for an exit signal.\n"); vmeDone = 1; wait_for_exit_signal(); atomic_set(&g_atom_has_exited, 1); @@ -317,6 +318,7 @@ fe_start_controller( void ) udelay( 1 ); } while ( ioMemData->iodata[ ll ][ 0 ].cycle != 0 ); pLocalEpics->epicsOutput.fe_status = NORMAL_RUN; + RTSLOG_INFO("Controller initialization complete, starting front end control loop\n"); timeSec = ioMemData->iodata[ ll ][ 0 ].timeSec; cpuClock[ CPU_TIME_CYCLE_END ] = rdtsc_ordered( ); @@ -390,6 +392,7 @@ fe_start_controller( void ) pLocalEpics->epicsOutput.stateWord = FE_ERROR_ADC; pLocalEpics->epicsOutput.diagWord |= ADC_TIMEOUT_ERR; pLocalEpics->epicsOutput.fe_status = ADC_TO_ERROR; + RTSLOG_ERROR("An ADC timeout error has been detected, waiting for an exit signal.\n"); deallocate_dac_channels( ); wait_for_exit_signal(); atomic_set(&g_atom_has_exited, 1); @@ -445,7 +448,7 @@ fe_start_controller( void ) if ( ( cycleNum % 2048 ) == 0 ) { usleep_range( 1, 3 ); - printl( "cycleNum = %d\n", cycleNum ); + RTSLOG_INFO( "cycleNum = %d\n", cycleNum ); } #endif diff --git a/src/fe/controllerAppUser.c b/src/fe/controllerAppUser.c index e43da6598f9bbcd43006f993d8a516cac098f743..91b0c40ec4573180e795663b63e0881c9a0d0996 100644 --- a/src/fe/controllerAppUser.c +++ b/src/fe/controllerAppUser.c @@ -38,7 +38,8 @@ #include "cds_types.h" #include "controller.h" #include "timing_common.h" // timing module / IRIG-B functions -#include "util/printl.h" + + #ifndef NO_DAQ #include "drv/fb.h" @@ -51,6 +52,8 @@ #include "drv/app_dac_functions.h" #include "drv/dac_info.h" +#include "drv/rts-logger.h" + // #include "dolphin_usp.c" #include <linux/version.h> @@ -72,7 +75,7 @@ gpsclock_timestring(char* line, int size) timef = fopen( "/sys/kernel/gpstime/time", "r" ); if ( !timef ) { - printl( "Cannot find GPS time \n" ); + RTSLOG_ERROR( "Cannot find GPS time \n" ); return; } fgets( line, 100, timef ); @@ -96,7 +99,7 @@ getGpsTimeProc( ) gpsclock_timestring(line, 100); mytime = atoi( line ); - printl( "GPS TIME is %d\n", mytime ); + RTSLOG_INFO( "GPS TIME is %d\n", mytime ); return ( mytime ); } @@ -186,7 +189,7 @@ fe_start_app_user( ) pEpicsComms = (RFM_FE_COMMS*)_epics_shm; pLocalEpics = (CDS_EPICS*)&pEpicsComms->epicsSpace; pEpicsDaq = (char*)&( pLocalEpics->epicsOutput ); - // printl("Epics at 0x%x and DAQ at 0x%x size = %d + // RTSLOG_DEBUG("Epics at 0x%x and DAQ at 0x%x size = %d // \n",pLocalEpics,pEpicsDaq,sizeof(CDS_EPICS_IN)); #ifdef OVERSAMPLE @@ -271,11 +274,11 @@ fe_start_app_user( ) /// \> Initialize IIR filter bank values if ( initVars( pDsp[ 0 ], pDsp[ 0 ], dspCoeff, MAX_MODULES, pCoeff[ 0 ] ) ) { - printl( "Filter module init failed, exiting\n" ); + RTSLOG_ERROR( "Filter module init failed, exiting\n" ); return 0; } - printl( "Initialized servo control parameters.\n" ); + RTSLOG_INFO( "Initialized servo control parameters.\n" ); usleep( 1000 ); @@ -298,10 +301,10 @@ fe_start_app_user( ) daq.xTpMin = daq.filtTpMax; daq.xTpMax = daq.xTpMin + GDS_MAX_NFM_TP; - printl( "DAQ Ex Min/Max = %d %d\n", daq.filtExMin, daq.filtExMax ); - printl( "DAQ XEx Min/Max = %d %d\n", daq.xExMin, daq.xExMax ); - printl( "DAQ Tp Min/Max = %d %d\n", daq.filtTpMin, daq.filtTpMax ); - printl( "DAQ XTp Min/Max = %d %d\n", daq.xTpMin, daq.xTpMax ); + RTSLOG_INFO( "DAQ Ex Min/Max = %d %d\n", daq.filtExMin, daq.filtExMax ); + RTSLOG_INFO( "DAQ XEx Min/Max = %d %d\n", daq.xExMin, daq.xExMax ); + RTSLOG_INFO( "DAQ Tp Min/Max = %d %d\n", daq.filtTpMin, daq.filtTpMax ); + RTSLOG_INFO( "DAQ XTp Min/Max = %d %d\n", daq.xTpMin, daq.xTpMax ); /// - ---- Assign DAC testpoint pointers for ( ii = 0; ii < cdsPciModules.dacCount; ii++ ) @@ -332,7 +335,7 @@ fe_start_app_user( ) pEpicsDaq ); if ( status == -1 ) { - printl( "DAQ init failed -- exiting\n" ); + RTSLOG_ERROR( "DAQ init failed -- exiting\n" ); vmeDone = 1; return ( 0 ); } @@ -342,7 +345,7 @@ fe_start_app_user( ) vmeDone = 0; /// \> Call user application software initialization routine. - printl( "Calling feCode() to initialize\n" ); + RTSLOG_INFO( "Calling feCode() to initialize\n" ); iopDacEnable = feCode( cycleNum, dWord, dacOut, @@ -358,6 +361,7 @@ fe_start_app_user( ) if ( status ) { pLocalEpics->epicsOutput.fe_status = DAC_INIT_ERROR; + RTSLOG_ERROR("Failed to initialize DAQ, waiting for an exit signal.\n"); return ( 0 ); } @@ -372,7 +376,7 @@ fe_start_app_user( ) // application. pLocalEpics->epicsOutput.fe_status = INIT_SYNC; ll = cdsPciModules.adcConfig[ 0 ]; - printl( "waiting to sync %d\n", ioMemData->iodata[ ll ][ 0 ].cycle ); + RTSLOG_INFO( "waiting to sync %d\n", ioMemData->iodata[ ll ][ 0 ].cycle ); clock_gettime( CLOCK_MONOTONIC, &cpuClock[ CPU_TIME_CYCLE_START ] ); // Spin until cycle 0 detected in first ADC buffer location. @@ -388,7 +392,7 @@ fe_start_app_user( ) cpuClock[ CPU_TIME_CYCLE_END ].tv_nsec - cpuClock[ CPU_TIME_CYCLE_START ].tv_nsec; timeinfo.cycleTime /= 1000; - printl( "Synched %d\n", timeinfo.cycleTime ); + RTSLOG_INFO( "Synched %d\n", timeinfo.cycleTime ); // Need to set sync21pps so code will not try to sync with 1pps pulse later. sync21pps = 1; // Get GPS seconds from MASTER @@ -398,8 +402,10 @@ fe_start_app_user( ) timeSec--; onePpsTime = cycleNum; - printl( "Using local GPS time %d \n", timeSec ); + RTSLOG_INFO( "Using local GPS time %d \n", timeSec ); pLocalEpics->epicsOutput.fe_status = NORMAL_RUN; + RTSLOG_INFO("Controller initialization complete, starting front end control loop\n"); + clock_gettime( CLOCK_MONOTONIC, &adcTime ); @@ -427,7 +433,7 @@ fe_start_app_user( ) if ( cycleNum == 0 ) { /// - ---- Check awgtpman status. - // printl("awgtpman gps = %d local = %d\n", + // RTSLOG_DEBUG("awgtpman gps = %d local = %d\n", // pEpicsComms->padSpace.awgtpman_gps, timeSec); pLocalEpics->epicsOutput.awgStat = ( pEpicsComms->padSpace.awgtpman_gps != timeSec ); @@ -474,7 +480,7 @@ fe_start_app_user( ) /// DAC channel reservation and exit the code. if ( adcinfo.adcWait >= MAX_ADC_WAIT_CONTROL ) { - printl( "ADC TIMEOUT %d %d %d %d\n", + RTSLOG_ERROR( "ADC TIMEOUT %d %d %d %d\n", mm, ioMemData->iodata[ mm ][ ioMemCntr ].cycle, ioMemCntr, @@ -829,7 +835,7 @@ fe_start_app_user( ) /// \> If not exit request, then continue INFINITE LOOP ******* } - printl( "exiting from fe_code()\n" ); + RTSLOG_INFO( "exiting from fe_code()\n" ); pLocalEpics->epicsOutput.cpuMeter = 0; deallocate_dac_channels( ); diff --git a/src/fe/controllerIop.c b/src/fe/controllerIop.c index 942d28f4343f0391de0067ab773a1b3c1a93d463..3df2a7ec1611d0ffa2fae1178a7a29b93cc71159 100644 --- a/src/fe/controllerIop.c +++ b/src/fe/controllerIop.c @@ -45,6 +45,7 @@ #include "drv/gsc_dac_common.h" //DAC_CLK_ENABLE #include "drv/contec1616.h" //stop_tds_clocks() #include "drv/ligoPcieTiming.h" //lptc_*() +#include "drv/rts-logger.h" #include "fm10Gen.h" //checkFiltReset() #include "../fe/timing_common.h" //captureEocTiming() #include "drv/epicsXfer.h" //checkEpicsReset() @@ -257,6 +258,7 @@ fe_start_controller( void ) { pLocalEpics->epicsOutput.fe_status = FILT_INIT_ERROR; fe_status_return = FILT_INIT_ERROR; + RTSLOG_ERROR("Failed to initialize filter banks, waiting for an exit signal.\n"); wait_for_exit_signal(); atomic_set(&g_atom_has_exited, 1); return; @@ -293,6 +295,7 @@ fe_start_controller( void ) { pLocalEpics->epicsOutput.fe_status = DAQ_INIT_ERROR; fe_status_return = DAQ_INIT_ERROR; + RTSLOG_ERROR("Failed to initialize DAQ, waiting for an exit signal.\n"); vmeDone = 1; wait_for_exit_signal(); atomic_set(&g_atom_has_exited, 1); @@ -536,6 +539,7 @@ fe_start_controller( void ) } pLocalEpics->epicsOutput.fe_status = NORMAL_RUN; + RTSLOG_INFO("Controller initialization complete, starting front end control loop\n"); pLocalEpics->epicsOutput.timeErr = syncSource; #ifdef REMOTE_GPS @@ -623,6 +627,7 @@ fe_start_controller( void ) pLocalEpics->epicsOutput.stateWord = FE_ERROR_ADC; pLocalEpics->epicsOutput.diagWord |= ADC_TIMEOUT_ERR; pLocalEpics->epicsOutput.fe_status = ADC_TO_ERROR; + RTSLOG_ERROR("An ADC timeout error has been detected, waiting for an exit signal.\n"); pLocalEpics->epicsOutput.epicsSync++; atomic_set(&g_atom_should_exit, 1); vmeDone = 1; @@ -636,6 +641,7 @@ fe_start_controller( void ) feStatus |= adc_status_update( &adcinfo ); pLocalEpics->epicsOutput.stateWord = FE_ERROR_ADC; pLocalEpics->epicsOutput.fe_status = CHAN_HOP_ERROR; + RTSLOG_ERROR("A channel hop error has been detected, waiting for an exit signal.\n"); atomic_set(&g_atom_should_exit, 1); vmeDone = 1; pLocalEpics->epicsOutput.epicsSync++; diff --git a/src/fe/controllerIopUser.c b/src/fe/controllerIopUser.c index 51a0ef29276e5984bde0003efdc9c2872e3cb0a9..f472e7c34aaaf585023c8d653e833ca4d8b3ec9e 100644 --- a/src/fe/controllerIopUser.c +++ b/src/fe/controllerIopUser.c @@ -38,7 +38,6 @@ #include "cds_types.h" #include "controller.h" #include "controllerko.h" //tdsControl, tdsCount, etc -#include "util/printl.h" #ifndef NO_DAQ #include "drv/fb.h" @@ -49,6 +48,8 @@ #include "drv/inputFilterModule.h" #include "drv/inputFilterModule1.h" #include "drv/dac_info.h" +#include "drv/rts-logger.h" + #include "../fe/timing_common.h" // timing module / IRIG-B functions @@ -75,7 +76,7 @@ gpsclock_timestring(char* line, int size) timef = fopen( "/sys/kernel/gpstime/time", "r" ); if ( !timef ) { - printl( "Cannot find GPS time \n" ); + RTSLOG_ERROR( "Cannot find GPS time \n" ); return; } fgets( line, 100, timef ); @@ -96,7 +97,7 @@ getGpsTimeProc( ) gpsclock_timestring(line, 100); mytime = atoi( line ); - printl( "GPS TIME is %d\n", mytime ); + RTSLOG_INFO( "GPS TIME is %d\n", mytime ); return ( mytime ); } void @@ -111,7 +112,7 @@ initAdcModules( adcInfo_t* adcinfo ) pLocalEpics->epicsOutput.statAdc[ jj ] = 1; adcinfo->adcRdTimeErr[ jj ] = 0; } - printl( "ADC setup complete \n" ); + RTSLOG_INFO( "ADC setup complete \n" ); } void initDacModules( void ) @@ -123,7 +124,7 @@ initDacModules( void ) { pLocalEpics->epicsOutput.statDac[ jj ] = DAC_FOUND_BIT; } - printl( "DAC setup complete \n" ); + RTSLOG_INFO( "DAC setup complete \n" ); } //*********************************************************************** @@ -259,7 +260,7 @@ fe_start_iop_user( ) pEpicsComms = (RFM_FE_COMMS*)_epics_shm; pLocalEpics = (CDS_EPICS*)&pEpicsComms->epicsSpace; pEpicsDaq = (char*)&( pLocalEpics->epicsOutput ); - // printl("Epics at 0x%x and DAQ at 0x%x size = %d + // RTSLOG_DEBUG("Epics at 0x%x and DAQ at 0x%x size = %d // \n",pLocalEpics,pEpicsDaq,sizeof(CDS_EPICS_IN)); /// \> Zero out DAC outputs @@ -303,22 +304,22 @@ fe_start_iop_user( ) // if Contec 1616 BIO present, TDS receiver will be used for timing. syncSource = SYNC_SRC_TIMER; - printl( "Sync source = %d\n", syncSource ); + RTSLOG_INFO( "Sync source = %d\n", syncSource ); /// \> Wait for BURT restore.\n /// - ---- Code will exit if BURT flag not set by EPICS sequencer. // Do not proceed until EPICS has had a BURT restore // ******************************* - printl( "Waiting for EPICS BURT Restore = %d\n", + RTSLOG_INFO( "Waiting for EPICS BURT Restore = %d\n", pLocalEpics->epicsInput.burtRestore ); cnt = 0; do { usleep( 80000 ); - printl( "Waiting for EPICS BURT %d\n", cnt++ ); + RTSLOG_INFO( "Waiting for EPICS BURT Restore %d\n", cnt++ ); } while ( !pLocalEpics->epicsInput.burtRestore ); - printl( "BURT Restore Complete\n" ); + RTSLOG_INFO( "BURT Restore Complete\n" ); // BURT has completed // ******************************************************************* @@ -369,11 +370,11 @@ fe_start_iop_user( ) /// \> Initialize IIR filter bank values if ( initVars( pDsp[ 0 ], pDsp[ 0 ], dspCoeff, MAX_MODULES, pCoeff[ 0 ] ) ) { - printl( "Filter module init failed, exiting\n" ); + RTSLOG_ERROR( "Filter module init failed, exiting\n" ); return 0; } - printl( "Initialized servo control parameters.\n" ); + RTSLOG_INFO( "Initialized servo control parameters.\n" ); usleep( 1000 ); @@ -396,10 +397,10 @@ fe_start_iop_user( ) daq.xTpMin = daq.filtTpMax; daq.xTpMax = daq.xTpMin + GDS_MAX_NFM_TP; - printl( "DAQ Ex Min/Max = %d %d\n", daq.filtExMin, daq.filtExMax ); - printl( "DAQ XEx Min/Max = %d %d\n", daq.xExMin, daq.xExMax ); - printl( "DAQ Tp Min/Max = %d %d\n", daq.filtTpMin, daq.filtTpMax ); - printl( "DAQ XTp Min/Max = %d %d\n", daq.xTpMin, daq.xTpMax ); + RTSLOG_INFO( "DAQ Ex Min/Max = %d %d\n", daq.filtExMin, daq.filtExMax ); + RTSLOG_INFO( "DAQ XEx Min/Max = %d %d\n", daq.xExMin, daq.xExMax ); + RTSLOG_INFO( "DAQ Tp Min/Max = %d %d\n", daq.filtTpMin, daq.filtTpMax ); + RTSLOG_INFO( "DAQ XTp Min/Max = %d %d\n", daq.xTpMin, daq.xTpMax ); /// - ---- Assign DAC testpoint pointers for ( ii = 0; ii < cdsPciModules.dacCount; ii++ ) @@ -430,7 +431,7 @@ fe_start_iop_user( ) pEpicsDaq ); if ( status == -1 ) { - printl( "DAQ init failed -- exiting\n" ); + RTSLOG_ERROR( "DAQ init failed -- exiting\n" ); vmeDone = 1; return ( 0 ); } @@ -440,7 +441,7 @@ fe_start_iop_user( ) vmeDone = 0; /// \> Call user application software initialization routine. - printl( "Calling feCode() to initialize\n" ); + RTSLOG_INFO( "Calling feCode() to initialize\n" ); iopDacEnable = feCode( cycleNum, dWord, dacOut, @@ -463,9 +464,9 @@ fe_start_iop_user( ) initDacModules( ); pLocalEpics->epicsOutput.fe_status = INIT_SYNC; - printl( "*******************************\n" ); - printl( "* Running on timer! *\n" ); - printl( "*******************************\n" ); + RTSLOG_INFO( "*******************************\n" ); + RTSLOG_INFO( "* Running on timer! *\n" ); + RTSLOG_INFO( "*******************************\n" ); long timeoff = 0; /// Sync up to the 1Hz boundary do @@ -487,6 +488,8 @@ fe_start_iop_user( ) /// ******************************************************************************\n pLocalEpics->epicsOutput.fe_status = NORMAL_RUN; + RTSLOG_INFO("Controller initialization complete, starting front end control loop\n"); + while ( !vmeDone ) { // Run forever until user hits reset @@ -894,11 +897,11 @@ fe_start_iop_user( ) pLocalEpics->epicsOutput.stateWord = FE_ERROR_ADC; stop_working_threads = 1; vmeDone = 1; - printl( "Channel Hopping Detected on one or more ADC modules " + RTSLOG_ERROR( "Channel Hopping Detected on one or more ADC modules " "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" ); - printl( "Check GDSTP screen ADC status bits to id affected ADC " + RTSLOG_ERROR( "Check GDSTP screen ADC status bits to id affected ADC " "modules\n" ); - printl( "Code is exiting ..............\n" ); + RTSLOG_ERROR( "Code is exiting ..............\n" ); continue; } feStatus |= dac_status_update( &dacinfo ); @@ -960,7 +963,7 @@ fe_start_iop_user( ) /// \> If not exit request, then continue INFINITE LOOP ******* } - printl( "exiting from fe_code()\n" ); + RTSLOG_INFO( "exiting from fe_code()\n" ); pLocalEpics->epicsOutput.cpuMeter = 0; /* System reset command received */ diff --git a/src/fe/dolphin.c b/src/fe/dolphin.c index 3e11c7f8777a43bc7c3cb42f8e8b234b83450d58..ccc8c214541d6985e89d38ae81e7c1ccc5d36393 100644 --- a/src/fe/dolphin.c +++ b/src/fe/dolphin.c @@ -7,7 +7,7 @@ #include "../fe/dolphin.h" #include "commData3.h" #include "controller.h" //MAX_UDELAY, cdsPciModules -#include "util/printl.h" +#include "drv/rts-logger.h" #include "../drv/mbuf/mbuf_kernel.h" @@ -39,7 +39,7 @@ session_callback( session_cb_arg_t IN arg, uint32_t IN local_adapter_number ) { /// @brief This function contains the required Dolphin callback routine. \n - // printl("Session callback reason=%d status=%d target_node=%d\n", reason, + // RTSLOG_INFO("Session callback reason=%d status=%d target_node=%d\n", reason, // status, target_node); if (reason == SR_OK) iop_rfm_valid = 1; if ( reason == SR_OK || status == SS_NONE ) //TODO: This does not seem like a good check, we could pass if reason has an error and status is SR_NONE iop_rfm_valid = 1; @@ -58,7 +58,7 @@ connect_callback( void IN* arg, uint32_t IN reason, uint32_t IN status ) { - // printl("Connect callback reason=%d status=%d\n", reason, status); + // RTSLOG_INFO("Connect callback reason=%d status=%d\n", reason, status); if ( reason == 1 ) iop_rfm_valid = 1; if ( reason == 3 ) @@ -75,7 +75,7 @@ create_segment_callback( void IN* arg, uint32_t IN source_node, uint32_t IN local_adapter_number ) { - // printl("Create segment callback reason=%d source_node=%d\n", reason, + // RTSLOG_INFO("Create segment callback reason=%d source_node=%d\n", reason, // source_node); return 0; } @@ -98,12 +98,12 @@ init_dolphin( int modules ) create_segment_callback, 0, &segment[ ii ] ); - printl("DIS segment alloc status %d\n", err); + RTSLOG_INFO("DIS segment alloc status %d\n", err); if ( err ) return -1; err = sci_set_local_segment_available( segment[ ii ], 0 ); - printl("DIS segment making available status %d\n", err); + RTSLOG_INFO("DIS segment making available status %d\n", err); if ( err ) { sci_remove_segment( &segment[ ii ], 0 ); @@ -111,7 +111,7 @@ init_dolphin( int modules ) } err = sci_export_segment( segment[ ii ], 0, DIS_BROADCAST ); - printl("DIS segment export status 0x%x\n", err); + RTSLOG_INFO("DIS segment export status 0x%x\n", err); if ( err ) { sci_remove_segment( &segment[ ii ], 0 ); @@ -121,14 +121,14 @@ init_dolphin( int modules ) read_addr = sci_local_kernel_virtual_address( segment[ ii ] ); if ( read_addr == 0 ) { - printl("DIS sci_local_kernel_virtual_address returned 0\n"); + RTSLOG_INFO("DIS sci_local_kernel_virtual_address returned 0\n"); sci_unexport_segment( segment[ ii ], 0, 0); sci_remove_segment( &segment[ ii ], 0 ); return -4; } else { - printl("Dolphin memory read at 0x%p\n", read_addr); + RTSLOG_INFO("Dolphin memory read at 0x%p\n", read_addr); cdsPciModules.dolphinRead[ ii ] = (volatile unsigned long*)read_addr; } @@ -146,7 +146,7 @@ init_dolphin( int modules ) connect_callback, 0, &remote_segment_handle[ ii ] ); - printl("DIS connect segment status %d\n", err); + RTSLOG_INFO("DIS connect segment status %d\n", err); if ( err ) { sci_unexport_segment( segment[ ii ], 0, 0); @@ -161,7 +161,7 @@ init_dolphin( int modules ) 0, IPC_TOTAL_ALLOC_SIZE, &client_map_handle[ ii ] ); - printl("DIS segment mapping status 0x%x\n", err); + RTSLOG_INFO("DIS segment mapping status 0x%x\n", err); if ( err ) { sci_disconnect_segment( &remote_segment_handle[ ii ], 0 ); @@ -173,7 +173,7 @@ init_dolphin( int modules ) addr = sci_kernel_virtual_address_of_mapping( client_map_handle[ ii ] ); if ( addr == 0 ) { - // printl ("Got zero pointer from + // RTSLOG_INFO ("Got zero pointer from // sci_kernel_virtual_address_of_mapping\n"); sci_disconnect_segment( &remote_segment_handle[ ii ], 0 ); sci_unexport_segment( segment[ ii ], 0, 0); @@ -182,7 +182,7 @@ init_dolphin( int modules ) } else { - printl ("Dolphin memory write at 0x%p\n", addr); + RTSLOG_INFO("Dolphin memory write at 0x%p\n", addr); cdsPciModules.dolphinWrite[ ii ] = (volatile unsigned long*)addr; } diff --git a/src/fe/map.c b/src/fe/map.c index 9199ee32ce407c79a19f6280bcb4f1b668981f20..48af4f83c8be07eb4a3e78a027fb00d3fa3b9a05 100644 --- a/src/fe/map.c +++ b/src/fe/map.c @@ -12,7 +12,7 @@ #include "commData3.h" #include "../drv/mbuf/mbuf_kernel.h" #include "map_cards_2_slots.h" -#include "util/printl.h" +#include "drv/rts-logger.h" // Include driver code for all supported I/O cards #include "drv/gsc16ai64.h" @@ -71,7 +71,7 @@ set_8111_prefetch( struct pci_dev* dacdev ) { struct pci_dev* dev = dacdev->bus->self; - printl( "set_8111_prefetch: subsys=0x%x; vendor=0x%x\n", + RTSLOG_INFO( "set_8111_prefetch: subsys=0x%x; vendor=0x%x\n", dev->device, dev->vendor ); if ( ( dev->device == 0x8111 ) && ( dev->vendor == PLX_VID ) ) @@ -162,7 +162,7 @@ mapPciModulesVirtual( CDS_HARDWARE* pCds ) if ( ret != MBUF_KERNEL_CODE_OK ) { mbuf_lookup_error_msg(ret, err_msg); - printl( "mbuf_allocate_area() failed, error msg: %s\n", err_msg ); + RTSLOG_ERROR( "mbuf_allocate_area() failed, error msg: %s\n", err_msg ); return -1; } pCds->pci_dac[ dac_cnt ] = (volatile int *)_device_shm; @@ -179,7 +179,7 @@ mapPciModulesVirtual( CDS_HARDWARE* pCds ) if ( ret != MBUF_KERNEL_CODE_OK ) { mbuf_lookup_error_msg(ret, err_msg); - printl( "mbuf_allocate_area() failed, error msg: %s\n", err_msg ); + RTSLOG_ERROR( "mbuf_allocate_area() failed, error msg: %s\n", err_msg ); return -1; } pCds->pci_dac[ dac_cnt ] = (volatile int *)_device_shm; @@ -196,7 +196,7 @@ mapPciModulesVirtual( CDS_HARDWARE* pCds ) if ( ret != MBUF_KERNEL_CODE_OK ) { mbuf_lookup_error_msg(ret, err_msg); - printl( "mbuf_allocate_area() failed, error msg: %s\n", err_msg ); + RTSLOG_ERROR( "mbuf_allocate_area() failed, error msg: %s\n", err_msg ); return -1; } pCds->pci_dac[ dac_cnt ] = (volatile int *)_device_shm; @@ -213,7 +213,7 @@ mapPciModulesVirtual( CDS_HARDWARE* pCds ) if ( ret != MBUF_KERNEL_CODE_OK ) { mbuf_lookup_error_msg(ret, err_msg); - printl( "mbuf_allocate_area() failed, error msg: %s\n", err_msg ); + RTSLOG_ERROR( "mbuf_allocate_area() failed, error msg: %s\n", err_msg ); return -1; } pCds->pci_adc[ adc_cnt ] = (volatile int *)_device_shm; @@ -260,6 +260,11 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) dacdev = NULL; status = 0; + // initialize dac duotone multipliers/divisors in case + // we don't have one or the other of DAC or ADC cards + pCds->adcDuoToneDivisor[ 0 ] = 1; + pCds->dacDuoToneMultiplier[ 0 ] = 1; + modCount = map_cards_2_slots ( &cdsPciModules ) ; // Map and Initialize ADC and DAC modules @@ -285,13 +290,13 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) pCds->adcSlot[ pCds->adcCount] = find_card_slot( pCds, GSC_16AI64SSA, adc_cnt ); status = gsc16ai64Init( pCds, dacdev ); pCds->adcTimeShift[ adc_cnt ] = pCds->cards_used[i].time_shift; - printl( "adc card on bus %x; device %x status %d\n", + RTSLOG_INFO( "adc card on bus %x; device %x status %d\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ), status ); if(status != 0) { - printl( "Map fault GSC16AI64 ADC number %d slot %d\n", + RTSLOG_ERROR( "Map fault GSC16AI64 ADC number %d slot %d\n", adc_cnt,pCds->adcSlot[ pCds->adcCount]); return IO_CARD_MAP_ERROR; } @@ -308,12 +313,12 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) pCds->adcSlot[ pCds->adcCount] = find_card_slot( pCds, GSC_18AI32SSC1M, fast_adc_cnt ); status = gsc18ai32Init( pCds, dacdev ); pCds->adcTimeShift[ adc_cnt ] = pCds->cards_used[i].time_shift; - printl( "fast adc card on bus %x; device %x\n", + RTSLOG_INFO( "fast adc card on bus %x; device %x\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ) ); if(status != 0) { - printl( "Map fault GSC18AI32 ADC number %d slot %d\n", + RTSLOG_ERROR( "Map fault GSC18AI32 ADC number %d slot %d\n", fast_adc_cnt,pCds->adcSlot[ pCds->adcCount]); return IO_CARD_MAP_ERROR; } @@ -331,12 +336,12 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) pCds->adcSlot[ pCds->adcCount] = find_card_slot( pCds, GSC_18AI64SSC, adc_750_cnt ); status = gsc18ai64Init( pCds, dacdev ); pCds->adcTimeShift[ adc_cnt ] = pCds->cards_used[i].time_shift; - printl( "750KHz adc card on bus %x; device %x\n", + RTSLOG_INFO( "750KHz adc card on bus %x; device %x\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ) ); if(status != 0) { - printl( "Map fault GSC18AI64 ADC number %d slot %d\n", + RTSLOG_ERROR( "Map fault GSC18AI64 ADC number %d slot %d\n", adc_750_cnt,pCds->adcSlot[ pCds->adcCount]); return IO_CARD_MAP_ERROR; } @@ -356,13 +361,13 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) { pCds->dacSlot[ pCds->dacCount] = find_card_slot( pCds, GSC_16AO16, dac_cnt ); status = gsc16ao16Init( pCds, dacdev ); - printl( "16 bit dac card on bus %x; device %x status %d\n", + RTSLOG_INFO( "16 bit dac card on bus %x; device %x status %d\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ), status ); if(status != 0) { - printl( "Map fault GSC16AO16 DAC number %d slot %d\n", + RTSLOG_ERROR( "Map fault GSC16AO16 DAC number %d slot %d\n", dac_cnt,pCds->dacSlot[ pCds->dacCount]); return IO_CARD_MAP_ERROR; } @@ -380,13 +385,13 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) { pCds->dacSlot[ pCds->dacCount] = find_card_slot( pCds, GSC_18AO8, dac_18bit_cnt ); status = gsc18ao8Init( pCds, dacdev ); - printl( "18-bit dac card on bus %x; device %x status %d\n", + RTSLOG_INFO( "18-bit dac card on bus %x; device %x status %d\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ), status ); if(status != 0) { - printl( "Map fault GSC18AO8 DAC number %d slot %d\n", + RTSLOG_ERROR( "Map fault GSC18AO8 DAC number %d slot %d\n", dac_18bit_cnt,pCds->dacSlot[ pCds->dacCount]); return IO_CARD_MAP_ERROR; } @@ -403,13 +408,13 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) { pCds->dacSlot[ pCds->dacCount] = find_card_slot( pCds, GSC_20AO8, dac_20bit_cnt ); status = gsc20ao8Init( pCds, dacdev ); - printl( "20-bit dac card on bus %x; device %x status %d\n", + RTSLOG_INFO( "20-bit dac card on bus %x; device %x status %d\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ), status ); if(status != 0) { - printl( "Map fault GSC18AO8 DAC number %d slot %d\n", + RTSLOG_ERROR( "Map fault GSC18AO8 DAC number %d slot %d\n", dac_20bit_cnt,pCds->dacSlot[ pCds->dacCount]); return IO_CARD_MAP_ERROR; } @@ -442,7 +447,7 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) } if ( use_it ) { - printl( "Access 24 BIO card on bus %x; device %x vendor 0x%x\n", + RTSLOG_INFO( "Access 24 BIO card on bus %x; device %x vendor 0x%x\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ), dacdev->device ); @@ -478,7 +483,7 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) } if ( use_it ) { - printl( "Access 8 BIO card on bus %x; device %x vendor 0x%x\n", + RTSLOG_INFO( "Access 8 BIO card on bus %x; device %x vendor 0x%x\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ), dacdev->device ); @@ -515,7 +520,7 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) } if ( use_it ) { - printl( "Access BIO-16 card on bus %x; device %x\n", + RTSLOG_INFO( "Access BIO-16 card on bus %x; device %x\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ) ); status = accesIiro16Init( pCds, dacdev ); @@ -548,7 +553,7 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) } if ( use_it ) { - printl( "Contec 6464 DIO card on bus %x; device %x\n", + RTSLOG_INFO( "Contec 6464 DIO card on bus %x; device %x\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ) ); status = contec6464Init( pCds, dacdev ); @@ -568,7 +573,7 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) // setting LIGO timing card (non-PCIe version) settings while ( ( dacdev = pci_get_device( CONTEC_VID, C_DIO_1616L_PE, dacdev ) ) ) { - printl( "Contec 1616 DIO card on bus %x; device %x\n", + RTSLOG_INFO( "Contec 1616 DIO card on bus %x; device %x\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ) ); status = contec1616Init( pCds, dacdev ); @@ -600,7 +605,7 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) } if ( use_it ) { - printl( "Contec BO card on bus %x; device %x\n", + RTSLOG_INFO( "Contec BO card on bus %x; device %x\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ) ); status = contec32OutInit( pCds, dacdev ); @@ -626,7 +631,7 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) // Look for TSYNC GPS board if ( ( dacdev = pci_get_device( TSYNC_VID, TSYNC_TID, dacdev ) ) ) { - printl( "TSYNC GPS card on bus %x; device %x\n", + RTSLOG_INFO( "TSYNC GPS card on bus %x; device %x\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ) ); status = spectracomGpsInit( pCds, dacdev ); @@ -638,11 +643,11 @@ mapPciModulesRealCards( CDS_HARDWARE* pCds ) while ( ( dacdev = pci_get_device( 0x10ee, PCI_ANY_ID, dacdev ) ) ) { if(dacdev != NULL) { - printl( "Xilinx card on bus %x; device %x vendor 0x%x\n", + RTSLOG_INFO( "Xilinx card on bus %x; device %x vendor 0x%x\n", dacdev->bus->number, PCI_SLOT( dacdev->devfn ), dacdev->device ); - status = lptcInit( pCds, dacdev ); + status = lptcInit( pCds, dacdev ); } } diff --git a/src/fe/mapApp.c b/src/fe/mapApp.c index 92447742bebb6ebd1ed9d921970e6e67727f5fa0..98d1fe6f5184d19d99711e8e17aea6a701334917 100644 --- a/src/fe/mapApp.c +++ b/src/fe/mapApp.c @@ -4,9 +4,9 @@ #include "mapApp.h" #include "controller.h" -#include FE_HEADER //SYSTEM_NAME_STRING_LOWER -#include "util/printl.h" +#include "drv/rts-logger.h" + int mapPciModules( CDS_HARDWARE* pCds ) @@ -14,7 +14,7 @@ mapPciModules( CDS_HARDWARE* pCds ) int status = 0; int ii, jj, kk; /// @param ii,jj,kk default loop counters - printl( SYSTEM_NAME_STRING_LOWER ":IOP clock %u\n", ioMemData->mem_data_rate ); + RTSLOG_INFO("IOP clock %u\n", ioMemData->mem_data_rate ); // Have to search thru all cards and find desired instance for application // IOP will map ADC cards first, then DAC and finally DIO diff --git a/src/fe/moduleLoad.c b/src/fe/moduleLoad.c index 58d6b4f76cc3b4b1059683cc08d2a9c90fe49c0a..b5821b7d06eaf74cb35e5a67c67b191c6b7b72e9 100644 --- a/src/fe/moduleLoad.c +++ b/src/fe/moduleLoad.c @@ -7,11 +7,11 @@ #include "rts-cpu-isolator/rts-cpu-isolator.h" #include "verify_card_count.h" #include "print_io_info.h" -#include "util/printl.h" #include "util/timing.h" #include "util/kernel/exit_signaling.h" #include "drv/map.h" //mapPciModules() #include "drv/ligoPcieTiming.h" +#include "drv/rts-logger.h" #include "../fe/verify_slots.h" #include "../fe/mapApp.h" //initmap() #include "../fe/dolphin.h" @@ -96,7 +96,7 @@ static int __init rt_fe_init( void ) /// Verify requested core is free. if ( is_cpu_occupied( CPUID ) ) { - printl( KERN_ALERT "Error: CPU %d already taken\n", CPUID ); + RTSLOG_ERROR("Error: CPU %d already taken\n", CPUID ); return -1; } #endif @@ -107,8 +107,7 @@ static int __init rt_fe_init( void ) int status = init_dolphin( 2 ); if ( status != 0 ) { - printl( "" SYSTEM_NAME_STRING_LOWER - ": ERROR: Dolphin Network initialization failed; status = %d\n", + RTSLOG_ERROR("Dolphin Network initialization failed; status = %d\n", status ); rt_fe_cleanup( ); return -6; @@ -124,8 +123,7 @@ static int __init rt_fe_init( void ) ret = attach_shared_memory( ); if ( ret < 0 ) { - printl( "" SYSTEM_NAME_STRING_LOWER - ": ERROR: mbuf_allocate_area failed; ret = %d\n", + RTSLOG_ERROR( "mbuf_allocate_area failed; ret = %d\n", ret ); rt_fe_cleanup( ); return ret; @@ -156,8 +154,7 @@ static int __init rt_fe_init( void ) // If no ADC cards were found, then cannot run if ( !cdsPciModules.adcCount ) { - printl( "" SYSTEM_NAME_STRING_LOWER - ": ERROR: No ADC cards found - exiting\n" ); + RTSLOG_ERROR( "No ADC cards found - exiting\n" ); rt_fe_cleanup( ); return -5; } @@ -199,8 +196,7 @@ static int __init rt_fe_init( void ) // wait to ensure EPICS is running before proceeding pLocalEpics->epicsOutput.fe_status = WAIT_BURT; msleep( 5000 ); - printl( "" SYSTEM_NAME_STRING_LOWER - ": Waiting for EPICS BURT Restore = %d\n", + RTSLOG_INFO( "Waiting for EPICS BURT Restore = %d\n", pLocalEpics->epicsInput.burtRestore ); /// Ensure EPICS running else exit for ( cnt = 0; cnt < 10 && pLocalEpics->epicsInput.burtRestore == 0; cnt++ ) @@ -209,8 +205,7 @@ static int __init rt_fe_init( void ) } if ( cnt == 10 ) { - printl( "" SYSTEM_NAME_STRING_LOWER - ": ERROR: EPICS restore not set - exiting\n" ); + RTSLOG_ERROR( "EPICS BURT restore not set - exiting\n" ); pLocalEpics->epicsOutput.fe_status = BURT_RESTORE_ERROR; // Cleanup rt_fe_cleanup( ); @@ -228,23 +223,22 @@ static int __init rt_fe_init( void ) print_io_info(SYSTEM_NAME_STRING_LOWER, &cdsPciModules, 0 ); #endif #ifdef REQUIRE_IO_CNT - printl( "IO stat = %d\n", io_config_stat ); + RTSLOG_INFO( "IO stat = %d\n", io_config_stat ); if ( io_config_stat == IO_CONFIG_ERROR || io_count_stat == IO_CONFIG_ERROR) { #ifdef DOLPHIN_TEST finish_dolphin( ); #endif pLocalEpics->epicsOutput.fe_status = IO_CONFIG_ERROR; - printl( "" SYSTEM_NAME_STRING_LOWER - ": ERROR: Exit on incorrect card count \n" ); + RTSLOG_ERROR( "Exit on incorrect card count \n" ); rt_fe_cleanup( ); return -5; } #endif - printl("model rate (Hz) = %d\n", MODEL_RATE_CPS); - printl("clock_div = %d\n", UNDERSAMPLE); - printl("usec_per_cycle = %d\n", USEC_PER_CYCLE); + RTSLOG_INFO("model rate (Hz) = %d\n", MODEL_RATE_CPS); + RTSLOG_INFO("clock_div = %d\n", UNDERSAMPLE); + RTSLOG_INFO("usec_per_cycle = %d\n", USEC_PER_CYCLE); pLocalEpics->epicsInput.vmeReset = 0; udelay( 2000 ); @@ -255,7 +249,7 @@ static int __init rt_fe_init( void ) fe_start_controller_kthread, 0, "fe_start_controller_kthread/%d", CPUID ); if ( IS_ERR( sthread ) ) { - printl( "Failed to kthread_create()\n" ); + RTSLOG_ERROR( "Failed to kthread_create()\n" ); detach_shared_memory(); return -1; } @@ -265,7 +259,7 @@ static int __init rt_fe_init( void ) #ifndef NO_CPU_SHUTDOWN pLocalEpics->epicsOutput.fe_status = LOCKING_CORE; - printl( "" SYSTEM_NAME_STRING_LOWER ": Locking CPU core %d\n", CPUID ); + RTSLOG_INFO( "Locking CPU core %d\n", CPUID ); // The code runs on the disabled CPU set_rt_callback( fe_start_controller, CPUID ); @@ -289,7 +283,7 @@ void wait_for_module_exit(void) msleep( 1 ); } - printl("It took %lld ms for the RT code to exit.\n", + RTSLOG_INFO("It took %lld ms for the RT code to exit.\n", (getMonotonic_ns_utin64() - stop_sig_time_ns)/1000000); set_rt_callback( 0, CPUID ); @@ -300,8 +294,9 @@ void wait_for_module_exit(void) } } -/// Kernel module cleanup function -static void __exit rt_fe_cleanup( void ) +// Kernel module cleanup function. +// We can't mark this as "__exit" because it can be called from rt_fe_init() on error +static void rt_fe_cleanup( void ) { // Signal the model to stop diff --git a/src/fe/moduleLoadCommon.c b/src/fe/moduleLoadCommon.c index 1c21c8225ae83a35ec13847cbc676b986854b46c..eacb6521f9047158e889f76015b0073a2d4bb469 100644 --- a/src/fe/moduleLoadCommon.c +++ b/src/fe/moduleLoadCommon.c @@ -6,46 +6,40 @@ #include "controller.h" //FILT_INIT_ERROR, etc #include "feComms.h" //RFM_FE_COMMS #include "controllerko.h" //tdsControl, tdsCount +#include "util/formatting.h" //snprintf #include "mbuf/mbuf_kernel.h" //MBUF_ERROR_MSG_ALLOC_LEN, MBUF_KERNEL_CODE_OK -#include "util/printl.h" +#include "../drv/mbuf/mbuf.h" +#include "drv/rts-logger.h" void print_exit_messages( int error_type, int error_sub, const char * sysname) { - printl( "%s : Brought the CPU back up\n", sysname ); + RTSLOG_INFO( "Brought the CPU back up\n"); switch ( error_type ) { case FILT_INIT_ERROR: - printl( "%s FE error: %s\n", - sysname, "exited on filter initiialization error" ); + RTSLOG_ERROR( "exited on filter initiialization error" ); break; case DAQ_INIT_ERROR: - printl( "%s FE error: %s\n", + RTSLOG_ERROR( "%s FE error: %s\n", sysname, "exited on DAQ initiialization error"); break; case CHAN_HOP_ERROR: - printl( "%s FE error: %s\n", - sysname, "exited on ADC Channel Hopping error"); - printl( "%s : Error detected on ADC %d\n", - sysname, error_sub ); + RTSLOG_ERROR( "exited on ADC Channel Hopping error"); + RTSLOG_ERROR( "detected on ADC %d\n", error_sub ); break; case BURT_RESTORE_ERROR: - printl( "%s FE error: %s\n", - sysname, "exited on BURT restore error"); + RTSLOG_ERROR( "exited on BURT restore error"); break; case DAC_INIT_ERROR: - printl( "%s FE error: %s\n", - sysname, "exited on DAC module initialization error" ); + RTSLOG_ERROR( "exited on DAC module initialization error" ); break; case ADC_TO_ERROR: - printl( "%s FE error: %s\n", - sysname, "exited on ADC module timeout error"); - printl( "%s : Error detected on ADC %d\n", - sysname, error_sub ); + RTSLOG_ERROR( "exited on ADC module timeout error"); + RTSLOG_ERROR( "detected on ADC %d\n", error_sub ); break; default: - printl( "Returning from cleanup_module " - "for %s\n", sysname ); + RTSLOG_INFO( "Returning from cleanup_module\n"); break; } } @@ -63,16 +57,15 @@ detach_shared_memory( ) return 0; } - int attach_shared_memory( ) { enum MBUF_KERNEL_CODE ret; - char fname[ 128 ]; + char fname[ MBUF_NAME_LEN ]; char err_msg[MBUF_ERROR_MSG_ALLOC_LEN]; /// Allocate EPICS memory area - sprintf( fname, "%s", SYSTEM_NAME_STRING_LOWER ); + snprintf( fname, MBUF_NAME_LEN, "%s", SYSTEM_NAME_STRING_LOWER ); ret = mbuf_allocate_area( fname, SHMEM_EPICS_SIZE, (volatile void **)&_epics_shm ); if ( ret != MBUF_KERNEL_CODE_OK ) goto attach_shared_memory_error; @@ -81,19 +74,19 @@ attach_shared_memory( ) pLocalEpics->epicsOutput.fe_status = 0; /// Allocate TP config memory area - sprintf( fname, "%s", SYSTEM_NAME_STRING_LOWER SHMEM_TESTPOINT_SUFFIX ); + snprintf( fname, MBUF_NAME_LEN, "%s", SYSTEM_NAME_STRING_LOWER SHMEM_TESTPOINT_SUFFIX ); ret = mbuf_allocate_area(fname, SHMEM_TESTPOINT_SIZE, (volatile void **)&_tp_shm ); if ( ret != MBUF_KERNEL_CODE_OK ) goto attach_shared_memory_error; /// Allocate AWG data memory area, and set pointer to AWG area - sprintf( fname, "%s", SYSTEM_NAME_STRING_LOWER SHMEM_AWG_SUFFIX); + snprintf( fname, MBUF_NAME_LEN, "%s", SYSTEM_NAME_STRING_LOWER SHMEM_AWG_SUFFIX); ret = mbuf_allocate_area(fname, SHMEM_AWG_SIZE, (volatile void **)&_awg_shm ); if ( ret != MBUF_KERNEL_CODE_OK ) goto attach_shared_memory_error; /// Allocate IPC memory area, ans assign pointer - sprintf( fname, "%s", "ipc"); + snprintf( fname, MBUF_NAME_LEN, "%s", "ipc"); ret = mbuf_allocate_area( fname, SHMEM_IOMEM_SIZE, (volatile void **) &_ipc_shm ); if ( ret != MBUF_KERNEL_CODE_OK ) goto attach_shared_memory_error; @@ -101,12 +94,12 @@ attach_shared_memory( ) ioMemData = (IO_MEM_DATA*)( _ipc_shm + 0x4000 ); /// Allocate Shared memory IPC comms memory area - sprintf( fname, "%s", "shmipc"); + snprintf( fname, MBUF_NAME_LEN, "%s", "shmipc"); ret = mbuf_allocate_area( fname, 16 * 1024 * 1024, (volatile void **)&_shmipc_shm ); if ( ret != MBUF_KERNEL_CODE_OK ) goto attach_shared_memory_error; /// Allocate DAQ memory area - sprintf( fname, "%s_daq", SYSTEM_NAME_STRING_LOWER ); + snprintf( fname, MBUF_NAME_LEN, "%s_daq", SYSTEM_NAME_STRING_LOWER ); ret = mbuf_allocate_area( fname, 64 * 1024 * 1024, (volatile void **)&_daq_shm ); if ( ret != MBUF_KERNEL_CODE_OK ) goto attach_shared_memory_error; @@ -116,13 +109,11 @@ attach_shared_memory( ) attach_shared_memory_error: mbuf_lookup_error_msg(ret, err_msg); - printl( SYSTEM_NAME_STRING_LOWER - ": ERROR: mbuf_allocate_area(%s) failed - %s ", - fname, err_msg ); + RTSLOG_ERROR( "mbuf_allocate_area(%s) failed - %s ", fname, err_msg ); return -12; - } + #ifdef IOP_MODEL void send_io_info_to_mbuf( int totalcards, CDS_HARDWARE* pCds ) diff --git a/src/fe/print_io_info.c b/src/fe/print_io_info.c index 9ddb5c1d03ccd2aa3f2b42c91cc09516a0fb4065..13b60d73e52dfe42a86504169ed642b63a6e295a 100644 --- a/src/fe/print_io_info.c +++ b/src/fe/print_io_info.c @@ -7,7 +7,9 @@ #ifndef USER_SPACE #include "../fe/timing_kernel.h" //current_time_fe #endif -#include "util/printl.h" + +#include "drv/rts-logger.h" + void print_io_info(const char* model_name, CDS_HARDWARE* cdsp, int iopmodel ) @@ -17,133 +19,131 @@ print_io_info(const char* model_name, CDS_HARDWARE* cdsp, int iopmodel ) jj = 0; #ifndef USER_SPACE - printl( "%s:startup time is %ld\n", - model_name, current_time_fe( ) ); - printl( "%s:cpu clock %u\n", model_name, cpu_khz ); + RTSLOG_INFO( "startup time is %ld\n", + current_time_fe( ) ); + RTSLOG_INFO( "cpu clock %u\n", cpu_khz ); #endif - printl( "%s:EPICSM at %p\n", - model_name, _epics_shm ); - printl( "%s:TPSM at %p\n", - model_name, _tp_shm ); - printl( "%s:AWGSM at %p\n", - model_name, _awg_shm ); - printl( "%s:IPC at %p\n", - model_name, _ipc_shm ); - printl( "%s:IOMEM at 0x%lx size 0x%lx\n", - model_name, ( (unsigned long)_ipc_shm + 0x4000 ), + RTSLOG_INFO( "EPICSM at %p\n", + _epics_shm ); + RTSLOG_INFO( "TPSM at %p\n", + _tp_shm ); + RTSLOG_INFO( "AWGSM at %p\n", + _awg_shm ); + RTSLOG_INFO( "IPC at %p\n", + _ipc_shm ); + RTSLOG_INFO( "IOMEM at 0x%lx size 0x%lx\n", + ( (unsigned long)_ipc_shm + 0x4000 ), sizeof( IO_MEM_DATA ) ); - printl( "%s:DAQSM at %p\n", - model_name, _daq_shm ); - printl( "%s:configured to use %d cards\n", - model_name, cdsp->cards ); + RTSLOG_INFO( "DAQSM at %p\n", + _daq_shm ); + RTSLOG_INFO( "configured to use %d cards\n", + cdsp->cards ); kk = 0; - printl( "******************************************************************" + RTSLOG_RAW( "******************************************************************" "*********\n" ); - printl( "%s:%d ADC cards found\n", - model_name, cdsp->adcCount ); + RTSLOG_INFO( "%d ADC cards found\n", + cdsp->adcCount ); for ( ii = 0; ii < cdsp->adcCount; ii++ ) { kk++; - printl( "%s:\tADC %d is a %s module\n", - model_name, ii, + RTSLOG_INFO( "\tADC %d is a %s module\n", + ii, _cdscardtypename[ cdsp->adcType[ ii ] ] ); if ( iopmodel ) { - printl( "%s:\t\tChannels = %d \n", - model_name, cdsp->adcChannels[ ii ] ); - printl( "%s:\t\tFirmware Rev = %d \n\n", - model_name, + RTSLOG_INFO( "\t\tChannels = %d \n", + cdsp->adcChannels[ ii ] ); + RTSLOG_INFO( "\t\tFirmware Rev = %d \n\n", ( cdsp->adcConfig[ ii ] & 0xfff ) ); } else { - printl( "%s:\tMemory at block %d\n", - model_name, cdsp->adcConfig[ ii ] ); + RTSLOG_INFO( "\tMemory at block %d\n", + cdsp->adcConfig[ ii ] ); } } - printl( "******************************************************************" + RTSLOG_RAW( "******************************************************************" "*********\n" ); - printl( "%s:%d DAC cards found\n", - model_name, cdsp->dacCount ); + RTSLOG_INFO( "%d DAC cards found\n", + cdsp->dacCount ); for ( ii = 0; ii < cdsp->dacCount; ii++ ) { kk++; - printl( "%s:\tDAC %d is a %s module\n", - model_name, ii, + RTSLOG_INFO( "\tDAC %d is a %s module\n", + ii, _cdscardtypename[ cdsp->dacType[ ii ] ] ); - printl( "%s:\tCard number is %d\n", - model_name, cdsp->dacInstance[ ii ] ); - printl( "%s:\tMemory at block %d\n", - model_name, cdsp->dacConfig[ ii ] ); + RTSLOG_INFO( "\tCard number is %d\n", + cdsp->dacInstance[ ii ] ); + RTSLOG_INFO( "\tMemory at block %d\n", + cdsp->dacConfig[ ii ] ); if ( iopmodel ) { if ( cdsp->dacType[ ii ] == GSC_16AO16 ) channels = 16; else channels = 8; - printl( "%s:\tChannels = %d \n", - model_name, channels ); - printl( "%s:\tFirmware Rev = %d \n\n", - model_name, ( cdsp->dacAcr[ ii ] & 0xfff ) ); + RTSLOG_INFO( "\tChannels = %d \n", + channels ); + RTSLOG_INFO( "\tFirmware Rev = %d \n\n", + ( cdsp->dacAcr[ ii ] & 0xfff ) ); } } kk += cdsp->doCount; - printl( "******************************************************************" + RTSLOG_RAW( "******************************************************************" "*********\n" ); - printl( "%s:%d DIO cards found\n", - model_name, cdsp->dioCount ); - printl( "******************************************************************" + RTSLOG_INFO( "%d DIO cards found\n", + cdsp->dioCount ); + RTSLOG_RAW( "******************************************************************" "*********\n" ); - printl( "%s:%d IIRO-8 Isolated DIO cards found\n", - model_name, cdsp->card_count[ ACS_8DIO ] ); - printl( "******************************************************************" + RTSLOG_INFO( "%d IIRO-8 Isolated DIO cards found\n", + cdsp->card_count[ ACS_8DIO ] ); + RTSLOG_RAW( "******************************************************************" "*********\n" ); - printl( "%s:%d IIRO-16 Isolated DIO cards found\n", - model_name, cdsp->card_count[ ACS_16DIO ] ); - printl( "******************************************************************" + RTSLOG_INFO( "%d IIRO-16 Isolated DIO cards found\n", + cdsp->card_count[ ACS_16DIO ] ); + RTSLOG_RAW( "******************************************************************" "*********\n" ); - printl( "%s:%d Contec 32ch PCIe DO cards found\n", - model_name, cdsp->card_count[ CON_32DO ] ); - printl( "%s:%d Contec PCIe DIO1616 cards found\n", - model_name, cdsp->card_count[ CON_1616DIO ] ); + RTSLOG_INFO( "%d Contec 32ch PCIe DO cards found\n", + cdsp->card_count[ CON_32DO ] ); + RTSLOG_INFO( "%d Contec PCIe DIO1616 cards found\n", + cdsp->card_count[ CON_1616DIO ] ); pLocalEpics->epicsOutput.bioMon[ 2 ] = cdsp->card_count[ CON_1616DIO ]; - printl( "%s:%d Contec PCIe DIO6464 cards found\n", - model_name, cdsp->card_count[ CON_6464DIO ] ); + RTSLOG_INFO( "%d Contec PCIe DIO6464 cards found\n", + cdsp->card_count[ CON_6464DIO ] ); pLocalEpics->epicsOutput.bioMon[ 3 ] = cdsp->card_count[ CON_6464DIO ]; - printl( "%s:%d Contec PCIe CDO64 cards found\n", - model_name, cdsp->card_count[ CDO64 ] ); + RTSLOG_INFO( "%d Contec PCIe CDO64 cards found\n", + cdsp->card_count[ CDO64 ] ); pLocalEpics->epicsOutput.bioMon[ 1 ] = cdsp->card_count[ CDO64 ]; - printl( "%s:%d Contec PCIe CDI64 cards found\n", - model_name, cdsp->card_count[ CDI64 ] ); + RTSLOG_INFO( "%d Contec PCIe CDI64 cards found\n", + cdsp->card_count[ CDI64 ] ); pLocalEpics->epicsOutput.bioMon[ 0 ] = cdsp->card_count[ CDI64 ]; - printl( "%s:%d DO cards found\n", model_name, cdsp->doCount ); - printl( "%s:Total of %d I/O modules found and mapped\n", - model_name, kk ); - printl( "******************************************************************" + RTSLOG_INFO( "%d DO cards found\n", cdsp->doCount ); + RTSLOG_INFO( "Total of %d I/O modules found and mapped\n", kk ); + RTSLOG_RAW( "******************************************************************" "*********\n" ); - printl( "%s:%d RFM cards found\n", - model_name, cdsp->rfmCount ); + RTSLOG_INFO( "%d RFM cards found\n", + cdsp->rfmCount ); for ( ii = 0; ii < cdsp->rfmCount; ii++ ) { - printl( "\tRFM %d is a VMIC_%x module with Node ID %d\n", + RTSLOG_INFO( "\tRFM %d is a VMIC_%x module with Node ID %d\n", ii, cdsp->rfmType[ ii ], cdsp->rfmConfig[ ii ] ); - printl( "address is 0x%lx\n", cdsp->pci_rfm[ ii ] ); + RTSLOG_INFO( "address is 0x%lx\n", cdsp->pci_rfm[ ii ] ); } - printl( "******************************************************************" + RTSLOG_RAW( "******************************************************************" "*********\n" ); if ( cdsp->gps ) { - printl( "%s:IRIG-B card found %d\n", - model_name, cdsp->gpsType ); - printl( "**************************************************************" + RTSLOG_INFO( "IRIG-B card found %d\n", + cdsp->gpsType ); + RTSLOG_RAW( "**************************************************************" "*************\n" ); } for ( ii = 0; ii < cdsp->dolphinCount; ii++ ) { - printl( "\tDolphin found %d\n", ii ); - printl( "Read address is %p\n", cdsp->dolphinRead[ ii ] ); - printl( "Write address is %p\n", cdsp->dolphinWrite[ ii ] ); + RTSLOG_INFO( "\tDolphin found %d\n", ii ); + RTSLOG_INFO( "Read address is %p\n", cdsp->dolphinRead[ ii ] ); + RTSLOG_INFO( "Write address is %p\n", cdsp->dolphinWrite[ ii ] ); } } diff --git a/src/fe/rcguser.c b/src/fe/rcguser.c index a803868f89896b325dcac202a5051a1c5b8e3561..c036fe324ee6141124cd823fb1090ffb844893da 100644 --- a/src/fe/rcguser.c +++ b/src/fe/rcguser.c @@ -28,7 +28,8 @@ #include "controller.h" #include "feComms.h" #include "print_io_info.h" -#include "util/printl.h" +#include "drv/rts-logger.h" + // These externs and "16" need to go to a header file (mbuf.h) extern int fe_start_app_user( ); @@ -75,10 +76,10 @@ main( int argc, char** argv ) // ******************************************************* Following I/O // card info is from feCode cards = sizeof( cards_used ) / sizeof( cards_used[ 0 ] ); - printl( "configured to use %d cards\n", cards ); + RTSLOG_INFO( "configured to use %d cards\n", cards ); cdsPciModules.cards = cards; cdsPciModules.cards_used = cards_used; - printl( "Initializing PCI Modules\n" ); + RTSLOG_INFO( "Initializing PCI Modules\n" ); cdsPciModules.adcCount = 0; cdsPciModules.dacCount = 0; cdsPciModules.dioCount = 0; @@ -88,7 +89,7 @@ main( int argc, char** argv ) // If running as a control process, I/O card information is via ipc shared // memory - printl( "%d PCI cards found\n", ioMemData->totalCards ); + RTSLOG_INFO( "%d PCI cards found\n", ioMemData->totalCards ); initmap( &cdsPciModules ); /// Call PCI initialization routine in map.c file. @@ -97,14 +98,14 @@ main( int argc, char** argv ) // If no ADC cards were found, then control cannot run if ( !cdsPciModules.adcCount ) { - printl( "No ADC cards found - exiting\n" ); + RTSLOG_ERROR( "No ADC cards found - exiting\n" ); mainReturn = -1; goto cleanup; } - printl( "%d PCI cards found \n", status ); + RTSLOG_INFO( "%d PCI cards found \n", status ); if ( status < cards ) { - printl( " ERROR **** Did not find correct number of cards! Expected %d " + RTSLOG_ERROR( "Did not find correct number of cards! Expected %d " "and Found %d\n", cards, status ); @@ -124,12 +125,12 @@ main( int argc, char** argv ) print_io_info(SYSTEM_NAME_STRING_LOWER, &cdsPciModules, 0 ); // Initialize buffer for daqLib.c code - printl( "Initializing space for daqLib buffers\n" ); + RTSLOG_INFO( "Initializing space for daqLib buffers\n" ); daqBuffer = (long)&daqArea[ 0 ]; for ( cnt = 0; cnt < 10 && pLocalEpics->epicsInput.burtRestore == 0; cnt++ ) { - printl( "Epics burt restore is %d\n", + RTSLOG_INFO( "Epics burt restore is %d\n", pLocalEpics->epicsInput.burtRestore ); usleep( 1000000 ); } diff --git a/src/fe/rcguserCommon.c b/src/fe/rcguserCommon.c index 189d861f75fbf24c4b38b963525fb87c56c32530..e15a8a57ce67feb9ae52af8c1c0ebc852e8cf79d 100644 --- a/src/fe/rcguserCommon.c +++ b/src/fe/rcguserCommon.c @@ -3,8 +3,8 @@ #include "print_io_info.h" #include "controller.h" -#include "util/printl.h" #include "drv/shmem.h" +#include "drv/rts-logger.h" #include <stddef.h> #include <stdio.h> @@ -18,7 +18,7 @@ intHandler( int signal) { (void) signal; pLocalEpics->epicsInput.vmeReset = 1; - printl( "Received exit signal, exiting...\n" ); + RTSLOG_INFO( "Received exit signal, exiting...\n" ); } // ********************************************************************************************** @@ -40,69 +40,69 @@ attach_shared_memory( const char* sysname ) g_epics_shm_handle = shmem_open(sysname_lower, SHMEM_EPICS_SIZE_MB); if ( g_epics_shm_handle == NULL ) { - printl( "shmem_open(%s, %d) failed; ret = %d\n", + RTSLOG_ERROR( "shmem_open(%s, %d) failed; ret = %p\n", sysname, SHMEM_EPICS_SIZE_MB, g_epics_shm_handle ); return -1; } _epics_shm = shmem_mapping(g_epics_shm_handle); - printl( "EPICSM at %p\n", _epics_shm ); + RTSLOG_INFO( "EPICSM at %p\n", _epics_shm ); // testpoint config shm used to control testpoints from awgtpman sprintf( shm_name, "%s%s", sysname_lower, SHMEM_TESTPOINT_SUFFIX ); g_tp_shm_handle = shmem_open(shm_name, SHMEM_TESTPOINT_SIZE_MB); if ( g_tp_shm_handle == NULL ) { - printl( "shmem_open(%s, %d) failed; ret = %d\n", + RTSLOG_ERROR( "shmem_open(%s, %d) failed; ret = %p\n", shm_name, SHMEM_TESTPOINT_SIZE_MB, g_tp_shm_handle ); return -1; } _tp_shm = shmem_mapping(g_tp_shm_handle); - printl( "TPSM at %p\n", _tp_shm ); + RTSLOG_INFO( "TPSM at %p\n", _tp_shm ); // awg data shm used to stream data from awgtpman sprintf( shm_name, "%s%s", sysname_lower, SHMEM_AWG_SUFFIX ); g_awg_shm_handle = shmem_open(shm_name, SHMEM_AWG_SIZE_MB); if ( g_awg_shm_handle == NULL ) { - printl( "shmem_open(%s, %d) failed; ret = %d\n", + RTSLOG_ERROR( "shmem_open(%s, %d) failed; ret = %p\n", shm_name, SHMEM_AWG_SIZE_MB, g_awg_shm_handle ); return -1; } _awg_shm = shmem_mapping(g_awg_shm_handle); - printl( "AWGSM at %p\n", _awg_shm ); + RTSLOG_INFO( "AWGSM at %p\n", _awg_shm ); // ipc_shm used to communicate with IOP g_ipc_shm_handle = shmem_open( SHMEM_IOMEM_NAME, SHMEM_IOMEM_SIZE_MB); if ( g_ipc_shm_handle == NULL ) { - printl( "shmem_open(%s, %d) failed; ret = %d\n", + RTSLOG_ERROR( "shmem_open(%s, %d) failed; ret = %p\n", SHMEM_IOMEM_NAME, SHMEM_IOMEM_SIZE_MB, g_ipc_shm_handle ); return -1; } _ipc_shm = shmem_mapping(g_ipc_shm_handle); - printl( "IPC at %p\n", _ipc_shm ); + RTSLOG_INFO( "IPC at %p\n", _ipc_shm ); ioMemData = (volatile IO_MEM_DATA*)( ( (char*)_ipc_shm ) + 0x4000 ); - printl("IOMEM at %p size 0x%lx\n", ioMemData, sizeof( IO_MEM_DATA ) ); - printl( "%d PCI cards found\n", ioMemData->totalCards ); + RTSLOG_INFO("IOMEM at %p size 0x%lx\n", ioMemData, sizeof( IO_MEM_DATA ) ); + RTSLOG_INFO( "%d PCI cards found\n", ioMemData->totalCards ); // DAQ is via shared memory sprintf( shm_name, "%s_daq", sysname_lower ); g_daq_shm_handle = shmem_open(shm_name, DEFAULT_SHMEM_ALLOC_SIZE_MB); if ( g_daq_shm_handle == NULL ) { - printl( "shmem_open(%s, %d) failed; ret = %d\n", + RTSLOG_ERROR( "shmem_open(%s, %d) failed; ret = %p\n", shm_name, DEFAULT_SHMEM_ALLOC_SIZE_MB, g_daq_shm_handle ); return -1; } _daq_shm = shmem_mapping(g_daq_shm_handle); - printl( "DAQSM at %p\n", _daq_shm ); + RTSLOG_INFO( "DAQSM at %p\n", _daq_shm ); daqPtr = (struct rmIpcStr*)_daq_shm; // shmipc is used to send SHMEM IPC data between processes on same computer g_shmipc_shm_handle = shmem_open(SHMEM_IPCCOMMS_NAME, SHMEM_IPCCOMMS_SIZE_MB); if ( g_shmipc_shm_handle == NULL ) { - printl( "shmem_open(%s, %d) failed; ret = %d\n", + RTSLOG_ERROR( "shmem_open(%s, %d) failed; ret = %p\n", SHMEM_IPCCOMMS_NAME, SHMEM_IPCCOMMS_SIZE_MB, g_shmipc_shm_handle ); return -1; } @@ -112,7 +112,7 @@ attach_shared_memory( const char* sysname ) g_io_shm_handle = shmem_open("virtual_io_space", DEFAULT_SHMEM_ALLOC_SIZE_MB); if ( g_io_shm_handle == NULL ) { - printl( "shmem_open(%s, %d) failed; ret = %d\n", + RTSLOG_ERROR( "shmem_open(%s, %d) failed; ret = %p\n", "virtual_io_space", DEFAULT_SHMEM_ALLOC_SIZE_MB, g_io_shm_handle ); return -1; } diff --git a/src/fe/rcguserIop.c b/src/fe/rcguserIop.c index ce6200baa466d6f5fad0a0288aa29498d9a603c5..003ac1b8972c54304ff54be2985d6260a454a9ab 100644 --- a/src/fe/rcguserIop.c +++ b/src/fe/rcguserIop.c @@ -21,35 +21,13 @@ #include "controllerko.h" //tdsControl, tdsCount, etc #include "controller.h" //daqArea #include "feComms.h" //RFM_FE_COMMS -#include "util/printl.h" +#include "drv/rts-logger.h" #include "../fe/print_io_info.h" // These externs and "16" need to go to a header file (mbuf.h) extern int fe_start_iop_user( ); -// Scan a double -#if 0 -double -simple_strtod(char *start, char **end) { - int integer; - if (*start != '.') { - integer = simple_strtol(start, end, 10); - if (*end == start) return 0.0; - start = *end; - } else integer = 0; - if (*start != '.') return integer; - else { - start++; - double frac = simple_strtol(start, end, 10); - if (*end == start) return integer; - int i; - for (i = 0; i < (*end - start); i++) frac /= 10.0; - return ((double)integer) + frac; - } - // Never reached -} -#endif void usage( ) @@ -88,11 +66,11 @@ main( int argc, char** argv ) { case 'm': sysname = optarg; - printl( "sysname = %s\n", sysname ); + RTSLOG_RAW( "sysname = %s\n", sysname ); break; case 't': cycleOffset = atoi( optarg ); - printl( "cycle offset = %d\n", cycleOffset ); + RTSLOG_INFO( "cycle offset = %d\n", cycleOffset ); break; case 'help': default: @@ -112,13 +90,13 @@ main( int argc, char** argv ) // ******************************************************* Following I/O // card info is from feCode cards = sizeof( cards_used ) / sizeof( cards_used[ 0 ] ); - printl( "configured to use %d cards\n", cards ); + RTSLOG_INFO( "configured to use %d cards\n", cards ); cdsPciModules.cards = cards; cdsPciModules.cards_used = cards_used; // return -1; - printl( "Initializing PCI Modules for IOP\n" ); + RTSLOG_INFO( "Initializing PCI Modules for IOP\n" ); for ( jj = 0; jj < cards; jj++ ) - printl( + RTSLOG_INFO( "Card %d type = %d\n", jj, cdsPciModules.cards_used[ jj ].type ); cdsPciModules.adcCount = 0; cdsPciModules.dacCount = 0; @@ -129,7 +107,7 @@ main( int argc, char** argv ) // If running as a control process, I/O card information is via ipc shared // memory - printl( "%d PCI cards found\n", cards ); + RTSLOG_INFO( "%d PCI cards found\n", cards ); status = 0; ioMemData->totalCards = cards; @@ -139,7 +117,7 @@ main( int argc, char** argv ) for ( jj = 0; jj < cards; jj++ ) { /* - printl("Model %d = %d, type = %d, instance = %d, dacCnt = %d \n", + RTSLOG_DEBUG("Model %d = %d, type = %d, instance = %d, dacCnt = %d \n", ii,ioMemData->model[ii], cdsPciModules.cards_used[jj].type, cdsPciModules.cards_used[jj].instance, @@ -207,17 +185,17 @@ main( int argc, char** argv ) // If no ADC cards were found, then control models cannot run if ( !cdsPciModules.adcCount ) { - printl( "No ADC cards found - exiting\n" ); + RTSLOG_ERROR( "No ADC cards found - exiting\n" ); return -1; } // This did not quite work for some reason // Need to find a way to handle skipped DAC cards in controllers // cdsPciModules.dacCount = ioMemData->dacCount; - printl( "%d PCI cards found \n", status ); + RTSLOG_INFO( "%d PCI cards found \n", status ); if ( status < cards ) { - printl( " ERROR **** Did not find correct number of cards! Expected %d " + RTSLOG_ERROR( "Did not find correct number of cards! Expected %d " "and Found %d\n", cards, status ); @@ -225,7 +203,7 @@ main( int argc, char** argv ) } // Print out all the I/O information - printl( "******************************************************************" + RTSLOG_RAW( "******************************************************************" "*********\n" ); // Master send module counds to control models via ipc shm ioMemData->totalCards = status; @@ -234,7 +212,7 @@ main( int argc, char** argv ) ioMemData->bioCount = cdsPciModules.doCount; // kk will act as ioMem location counter for mapping modules kk = cdsPciModules.adcCount; - printl( "%d ADC cards found\n", cdsPciModules.adcCount ); + RTSLOG_INFO( "%d ADC cards found\n", cdsPciModules.adcCount ); for ( ii = 0; ii < cdsPciModules.adcCount; ii++ ) { // MASTER maps ADC modules first in ipc shm for control models @@ -253,52 +231,52 @@ main( int argc, char** argv ) } if ( cdsPciModules.adcType[ ii ] == GSC_16AI64SSA ) { - printl( "\tADC %d is a GSC_16AI64SSA module\n", ii ); + RTSLOG_INFO( "\tADC %d is a GSC_16AI64SSA module\n", ii ); if ( ( cdsPciModules.adcConfig[ ii ] & 0x10000 ) > 0 ) jj = 32; else jj = 64; - printl( "\t\tChannels = %d \n", jj ); - printl( "\t\tFirmware Rev = %d \n\n", + RTSLOG_INFO( "\t\tChannels = %d \n", jj ); + RTSLOG_INFO( "\t\tFirmware Rev = %d \n\n", ( cdsPciModules.adcConfig[ ii ] & 0xfff ) ); } } - printl( "******************************************************************" + RTSLOG_RAW( "******************************************************************" "*********\n" ); - printl( "%d DAC cards found\n", cdsPciModules.dacCount ); + RTSLOG_INFO( "%d DAC cards found\n", cdsPciModules.dacCount ); for ( ii = 0; ii < cdsPciModules.dacCount; ii++ ) { if ( cdsPciModules.dacType[ ii ] == GSC_18AO8 ) { - printl( "\tDAC %d is a GSC_18AO8 module\n", ii ); + RTSLOG_INFO( "\tDAC %d is a GSC_18AO8 module\n", ii ); } if ( cdsPciModules.dacType[ ii ] == GSC_16AO16 ) { - printl( "\tDAC %d is a GSC_16AO16 module\n", ii ); + RTSLOG_INFO( "\tDAC %d is a GSC_16AO16 module\n", ii ); if ( ( cdsPciModules.dacConfig[ ii ] & 0x10000 ) == 0x10000 ) jj = 8; if ( ( cdsPciModules.dacConfig[ ii ] & 0x20000 ) == 0x20000 ) jj = 12; if ( ( cdsPciModules.dacConfig[ ii ] & 0x30000 ) == 0x30000 ) jj = 16; - printl( "\t\tChannels = %d \n", jj ); + RTSLOG_INFO( "\t\tChannels = %d \n", jj ); if ( ( cdsPciModules.dacConfig[ ii ] & 0xC0000 ) == 0x0000 ) { - printl( "\t\tFilters = None\n" ); + RTSLOG_INFO( "\t\tFilters = None\n" ); } if ( ( cdsPciModules.dacConfig[ ii ] & 0xC0000 ) == 0x40000 ) { - printl( "\t\tFilters = 10kHz\n" ); + RTSLOG_INFO( "\t\tFilters = 10kHz\n" ); } if ( ( cdsPciModules.dacConfig[ ii ] & 0xC0000 ) == 0x80000 ) { - printl( "\t\tFilters = 100kHz\n" ); + RTSLOG_INFO( "\t\tFilters = 100kHz\n" ); } if ( ( cdsPciModules.dacConfig[ ii ] & 0x100000 ) == 0x100000 ) { - printl( "\t\tOutput Type = Differential\n" ); + RTSLOG_INFO( "\t\tOutput Type = Differential\n" ); } - printl( "\t\tFirmware Rev = %d \n\n", + RTSLOG_INFO( "\t\tFirmware Rev = %d \n\n", ( cdsPciModules.dacConfig[ ii ] & 0xfff ) ); } // Pass DAC info to control processes @@ -307,28 +285,28 @@ main( int argc, char** argv ) // Following used by IOP to point to ipc memory for inputting DAC // data from control models cdsPciModules.dacConfig[ ii ] = kk; - printl( "MASTER DAC SLOT %d %d\n", ii, cdsPciModules.dacConfig[ ii ] ); + RTSLOG_INFO( "MASTER DAC SLOT %d %d\n", ii, cdsPciModules.dacConfig[ ii ] ); kk++; } - printl( "******************************************************************" + RTSLOG_RAW( "******************************************************************" "*********\n" ); - printl( "%d DIO cards found\n", cdsPciModules.dioCount ); - printl( "******************************************************************" + RTSLOG_INFO( "%d DIO cards found\n", cdsPciModules.dioCount ); + RTSLOG_RAW( "******************************************************************" "*********\n" ); - printl( "%d IIRO-8 Isolated DIO cards found\n", + RTSLOG_INFO( "%d IIRO-8 Isolated DIO cards found\n", cdsPciModules.card_count[ ACS_8DIO ] ); - printl( "******************************************************************" + RTSLOG_RAW( "******************************************************************" "*********\n" ); - printl( "%d IIRO-16 Isolated DIO cards found\n", + RTSLOG_INFO( "%d IIRO-16 Isolated DIO cards found\n", cdsPciModules.card_count[ ACS_16DIO ] ); - printl( "******************************************************************" + RTSLOG_RAW( "******************************************************************" "*********\n" ); - printl( "%d Contec 32ch PCIe DO cards found\n", cdsPciModules.card_count[ CON_32DO ] ); - printl( "%d Contec PCIe DIO1616 cards found\n", + RTSLOG_INFO( "%d Contec 32ch PCIe DO cards found\n", cdsPciModules.card_count[ CON_32DO ] ); + RTSLOG_INFO( "%d Contec PCIe DIO1616 cards found\n", cdsPciModules.card_count[ CON_1616DIO ] ); - printl( "%d Contec PCIe DIO6464 cards found\n", + RTSLOG_INFO( "%d Contec PCIe DIO6464 cards found\n", cdsPciModules.card_count[ CON_6464DIO ] ); - printl( "%d DO cards found\n", cdsPciModules.doCount ); + RTSLOG_INFO( "%d DO cards found\n", cdsPciModules.doCount ); // IOP sends DIO module information to control models // Note that for DIO, control modules will perform the I/O directly and // therefore need to know the PCIe address of these modules. @@ -339,7 +317,7 @@ main( int argc, char** argv ) if ( cdsPciModules.doType[ ii ] == CON_1616DIO ) { tdsControl[ tdsCount ] = ii; - printl( "TDS controller %d is at %d\n", tdsCount, ii ); + RTSLOG_INFO( "TDS controller %d is at %d\n", tdsCount, ii ); tdsCount++; } ioMemData->model[ kk ] = cdsPciModules.doType[ ii ]; @@ -348,8 +326,8 @@ main( int argc, char** argv ) ioMemData->ipc[ kk ] = kk; kk++; } - printl( "Total of %d I/O modules found and mapped\n", kk ); - printl( "******************************************************************" + RTSLOG_INFO( "Total of %d I/O modules found and mapped\n", kk ); + RTSLOG_RAW( "******************************************************************" "*********\n" ); print_io_info(SYSTEM_NAME_STRING_LOWER, &cdsPciModules, 1); // Following section maps Reflected Memory, both VMIC hardware style and @@ -371,13 +349,13 @@ main( int argc, char** argv ) #endif // Initialize buffer for daqLib.c code - printl( "Initializing space for daqLib buffers\n" ); + RTSLOG_INFO( "Initializing space for daqLib buffers\n" ); daqBuffer = (long)&daqArea[ 0 ]; // Wait for SDF restore for ( cnt = 0; cnt < 10 && pLocalEpics->epicsInput.burtRestore == 0; cnt++ ) { - printl( "Epics burt restore is %d\n", + RTSLOG_INFO( "Epics burt restore is %d\n", pLocalEpics->epicsInput.burtRestore ); usleep( 1000000 ); } diff --git a/src/fe/verify_card_count.c b/src/fe/verify_card_count.c index 4f8a7045103efd8d32a0414cedd9021af8f0ebf6..56c9b9afddb3038cc05ebd12d164fa7cfb027d64 100644 --- a/src/fe/verify_card_count.c +++ b/src/fe/verify_card_count.c @@ -3,7 +3,8 @@ #include "verify_card_count.h" #include "controller.h" //CDS_CARD_TYPES, IO_CONFIG_ERROR, -#include "util/printl.h" +#include "drv/rts-logger.h" + void initialize_card_counts( CDS_HARDWARE* pCds, int cards_per_model[] ) @@ -43,17 +44,16 @@ verify_card_count( CDS_HARDWARE* pCds, int model_cards[], const char* sysname ) { errStat = IO_CONFIG_ERROR; #ifdef REQUIRE_IO_CNT - printl( "%s: ERROR: Did not find correct number of %s cards \n", - sysname, _cdscardtypename[ ii ] ); - printl( "%s: ERROR: Expected %d and found %d - exiting\n", - sysname, + RTSLOG_ERROR( "Did not find correct number of %s cards \n", + _cdscardtypename[ ii ] ); + RTSLOG_ERROR( "Expected %d and found %d - exiting\n", model_cards[ ii ], pCds->card_count[ ii ] ); #else - printl( "%s: WARNING: Did not find correct number of %s cards \n", - sysname, _cdscardtypename[ ii ] ); - printl( "%s: WARNING: Expected %d and found %d \n", - sysname, model_cards[ ii ], + RTSLOG_WARN( "Did not find correct number of %s cards \n", + _cdscardtypename[ ii ] ); + RTSLOG_WARN( "Expected %d and found %d \n", + model_cards[ ii ], pCds->card_count[ ii ] ); #endif } diff --git a/src/include/drv/accesDio24.c b/src/include/drv/accesDio24.c index 1113eecf161f9f1086172fd9d8e2024f90836652..fb6822eba73cc74d5f064c0aff31f0b45dcd37af 100644 --- a/src/include/drv/accesDio24.c +++ b/src/include/drv/accesDio24.c @@ -12,7 +12,7 @@ // ***************************************************************************** #include "accesDio24.h" -#include "util/printl.h" +#include "drv/rts-logger.h" // Vendor defined card model number #define DIO_A_OUTPUT 0x8B @@ -39,10 +39,10 @@ accesDio24Init( CDS_HARDWARE* pHardware, struct pci_dev* diodev ) pedStatus = pci_enable_device( diodev ); /// Find the I/O address space for this module. pci_read_config_dword( diodev, PCI_BASE_ADDRESS_2, &pci_io_addr ); - printl( "dio pci2 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "dio pci2 = 0x%x\n", pci_io_addr ); /// Write I/O address info into the CDS_HARDWARE structure. pHardware->pci_do[ devNum ] = ( pci_io_addr - 1 ); - printl( "diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); + RTSLOG_INFO( "diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); outb_p( DIO_C_OUTPUT, pHardware->pci_do[ devNum ] + DIO_CTRL_REG ); /// Clear the present output from the module. outb( 0x00, pHardware->pci_do[ devNum ] + DIO_C_REG ); diff --git a/src/include/drv/accesIIRO16.c b/src/include/drv/accesIIRO16.c index 6805af0b491a7ea57fc9daddcbba009c242754a3..4d789fb0d48473a060dee452fdb122ca1cbbcd7e 100644 --- a/src/include/drv/accesIIRO16.c +++ b/src/include/drv/accesIIRO16.c @@ -6,7 +6,7 @@ ///< Manual</a> #include "accesIIRO16.h" -#include "util/printl.h" +#include "drv/rts-logger.h" // ***************************************************************************** /// \brief Routine to initialize ACCESS IIRO-16 Isolated DIO modules @@ -33,13 +33,13 @@ accesIiro16Init( CDS_HARDWARE* pHardware, struct pci_dev* diodev ) pedStatus = pci_enable_device( diodev ); /// Find the I/O address space for this module. pci_read_config_dword( diodev, PCI_BASE_ADDRESS_2, &pci_io_addr ); - printl( "iiro-16 dio pci2 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "iiro-16 dio pci2 = 0x%x\n", pci_io_addr ); /// Fill module data into the CDS_HARDWARE structure. pHardware->pci_do[ devNum ] = pci_io_addr - 1; pHardware->doType[ devNum ] = ACS_16DIO; pHardware->doInstance[ devNum ] = pHardware->card_count[ ACS_16DIO ]; pHardware->card_count[ ACS_16DIO ] ++; - printl( "iiro-16 diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); + RTSLOG_INFO( "iiro-16 diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); pHardware->doCount++; /// Return device enable status. diff --git a/src/include/drv/accesIIRO8.c b/src/include/drv/accesIIRO8.c index fc50338ffbe2ed533b89ac5b5532bb3174c14671..57b93cd1f90006b7a946f75276e97ee4a441c31c 100644 --- a/src/include/drv/accesIIRO8.c +++ b/src/include/drv/accesIIRO8.c @@ -6,7 +6,7 @@ ///< Manual</a> #include "accesIIRO8.h" -#include "util/printl.h" +#include "drv/rts-logger.h" // ***************************************************************************** /// \brief Routine to initialize ACCESS IIRO-8 Isolated DIO modules @@ -33,14 +33,14 @@ accesIiro8Init( CDS_HARDWARE* pHardware, struct pci_dev* diodev ) pedStatus = pci_enable_device( diodev ); /// Find the I/O address space for this module. pci_read_config_dword( diodev, PCI_BASE_ADDRESS_2, &pci_io_addr ); - printl( "iiro-8 dio pci2 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "iiro-8 dio pci2 = 0x%x\n", pci_io_addr ); /// Write I/O address info into the CDS_HARDWARE structure. pHardware->pci_do[ devNum ] = pci_io_addr - 1; /// Fill in remaining info into CDS_HARDWARE structure. pHardware->doType[ devNum ] = ACS_8DIO; pHardware->doInstance[ devNum ] = pHardware->card_count[ ACS_8DIO ]; pHardware->card_count[ ACS_8DIO ] ++; - printl( "iiro-8 diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); + RTSLOG_INFO( "iiro-8 diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); pHardware->doCount++; /// Return device enable status. return ( pedStatus ); diff --git a/src/include/drv/app_dac_functions.h b/src/include/drv/app_dac_functions.h index d1b0bc782b58af4bde3ed0327c47712b7f5410c8..9a741b4561492f75a07b1cd3dea5aadf0759d07e 100644 --- a/src/include/drv/app_dac_functions.h +++ b/src/include/drv/app_dac_functions.h @@ -5,10 +5,12 @@ #include "cds_types.h" #include "controller.h" //cdsPciModules #include "fm10Gen.h" +#include "drv/rts-logger.h" #include "drv/gsc16ao16.h" //GSAO_16BIT_MASK #include "drv/gsc18ao8.h" //GSAO_18BIT_MASK #include "drv/gsc20ao8.h" //GSAO_20BIT_MASK + #ifdef __cplusplus extern "C" { #endif @@ -33,9 +35,9 @@ app_dac_init( void ) { if ( ioMemData->dacOutUsed[ pd ][ jj ] ) { - // printl("Failed to allocate DAC channel.\n"); - // printl("DAC local %d global %d channel %d is already - // allocated.\n", ii, pd, jj); + RTSLOG_ERROR("Failed to reserve DAC channel for model.\n"); + RTSLOG_ERROR("DAC local %d global %d channel %d is already allocated.\n", + ii, pd, jj); return 1; } } diff --git a/src/include/drv/app_dio_routines.h b/src/include/drv/app_dio_routines.h index 0a78874e81690721cb2ecc462c96d877635ee920..f395af11f66efd6f5d48add9e90fe6c81aed475f 100644 --- a/src/include/drv/app_dio_routines.h +++ b/src/include/drv/app_dio_routines.h @@ -6,6 +6,7 @@ #include "controllerko.h" //CDIO6464InputInput, CDIO6464LastOutState, #include "drv/accesIIRO8.h" #include "drv/accesIIRO16.h" +#include "drv/rts-logger.h" #include "contec32o.h" #include "contec6464.h" #include "accesDio24.h" @@ -49,15 +50,15 @@ app_dio_init( void ) { CDIO6464LastOutState[ ii ] = contec6464ReadOutputRegister( &cdsPciModules, kk ); - // printl ("Initial state of contec6464 number %d = 0x%x - // \n",ii,CDIO6464LastOutState[ii]); + RTSLOG_DEBUG("Initial state of contec6464 number %d = 0x%x\n", + ii,CDIO6464LastOutState[ii]); } else if ( cdsPciModules.doType[ kk ] == CDI64 ) { CDIO6464LastOutState[ ii ] = contec6464ReadOutputRegister( &cdsPciModules, kk ); - // printl ("Initial state of contec6464 number %d = 0x%x - // \n",ii,CDIO6464LastOutState[ii]); + RTSLOG_DEBUG("Initial state of contec6464 number %d = 0x%x\n", + ii,CDIO6464LastOutState[ii]); } else if ( cdsPciModules.doType[ kk ] == ACS_24DIO ) { diff --git a/src/include/drv/cdsHardware.h b/src/include/drv/cdsHardware.h index 4ff90069dcae843b7a221a7f4836edbf56925aa6..c3bf3bf531a63a2d4d4b9a5a161ccd1f94e36b97 100644 --- a/src/include/drv/cdsHardware.h +++ b/src/include/drv/cdsHardware.h @@ -209,6 +209,7 @@ typedef struct CDS_HARDWARE{ int dacCount; /* Number of DAC modules found */ volatile int * pci_dac[MAX_DAC_MODULES]; /* Remapped addresses of DAC modules */ int dacType[MAX_DAC_MODULES]; + int dacDuoToneMultiplier[MAX_DAC_MODULES]; /* scale amplitude of duotone up for higher bit DACs */ int dacInstance[MAX_DAC_MODULES]; int dacSlot[MAX_DAC_MODULES]; int dacConfig[MAX_DAC_MODULES]; @@ -217,6 +218,7 @@ typedef struct CDS_HARDWARE{ int adcCount; /* Number of ADC modules found */ volatile int *pci_adc[MAX_ADC_MODULES]; /* Remapped addresses of ADC modules */ int adcType[MAX_ADC_MODULES]; + int adcDuoToneDivisor[MAX_ADC_MODULES]; /* scale amplitude of duotone down for higher bit ADCs */ int adcInstance[MAX_ADC_MODULES]; int adcSlot[MAX_ADC_MODULES]; int adcChannels[MAX_ADC_MODULES]; diff --git a/src/include/drv/contec1616.c b/src/include/drv/contec1616.c index a2dd246fa245607fa497c2a49db06b8db6736560..6aa9860937244a4e5e6cd362ef4c9e7440edb94e 100644 --- a/src/include/drv/contec1616.c +++ b/src/include/drv/contec1616.c @@ -10,7 +10,7 @@ #include "contec1616.h" #include "controller.h" #include "controllerko.h" //CDIO* -#include "util/printl.h" +#include "drv/rts-logger.h" #include <linux/delay.h> //udelay() @@ -40,13 +40,13 @@ contec1616Init( CDS_HARDWARE* pHardware, struct pci_dev* diodev ) pedStatus = pci_enable_device( diodev ); /// Find the I/O address space for this module. pci_read_config_dword( diodev, PCI_BASE_ADDRESS_0, &pci_io_addr ); - printl( "contec 1616 dio pci2 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "contec 1616 dio pci2 = 0x%x\n", pci_io_addr ); /// Write I/O address info into the CDS_HARDWARE structure. pHardware->pci_do[ devNum ] = pci_io_addr - 1; - printl( "contec 1616 diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); + RTSLOG_INFO( "contec 1616 diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); /// Read board number switch setting on module pci_read_config_dword( diodev, PCI_REVISION_ID, &id ); - printl( "contec dio pci2 card number= 0x%x\n", ( id & 0xf ) ); + RTSLOG_INFO( "contec dio pci2 card number= 0x%x\n", ( id & 0xf ) ); /// Fill in remaining info into CDS_HARDWARE structure. pHardware->doType[ devNum ] = CON_1616DIO; pHardware->doCount++; diff --git a/src/include/drv/contec32o.c b/src/include/drv/contec32o.c index da339ab0b4ebc14a08abb2942761189f7211857f..a857262dc5cf84d34b282d8ddea1a3713b12c553 100644 --- a/src/include/drv/contec32o.c +++ b/src/include/drv/contec32o.c @@ -8,7 +8,8 @@ // ***************************************************************************** #include "contec32o.h" -#include "util/printl.h" +#include "drv/rts-logger.h" + int contec32OutInit( CDS_HARDWARE* pHardware, struct pci_dev* diodev ) @@ -21,11 +22,11 @@ contec32OutInit( CDS_HARDWARE* pHardware, struct pci_dev* diodev ) devNum = pHardware->doCount; pedStatus = pci_enable_device( diodev ); pci_read_config_dword( diodev, PCI_BASE_ADDRESS_0, &pci_io_addr ); - printl( "contec dio pci2 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "contec dio pci2 = 0x%x\n", pci_io_addr ); pHardware->pci_do[ devNum ] = pci_io_addr - 1; - printl( "contec32L diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); + RTSLOG_INFO( "contec32L diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); pci_read_config_dword( diodev, PCI_REVISION_ID, &id ); - printl( "contec dio pci2 card number= 0x%x\n", ( id & 0xf ) ); + RTSLOG_INFO( "contec dio pci2 card number= 0x%x\n", ( id & 0xf ) ); pHardware->doType[ devNum ] = CON_32DO; pHardware->doCount++; pHardware->doInstance[ devNum ] = pHardware->card_count[ CON_32DO ]; @@ -41,8 +42,6 @@ contec32WriteOutputRegister( CDS_HARDWARE* pHardware, int modNum, unsigned int data ) { - // printl("writeCDO32l modNum = %d\n",modNum); - // printl("writeCDO32l data = %d\n",data); outl( data, pHardware->pci_do[ modNum ] ); return ( inl( pHardware->pci_do[ modNum ] ) ); } diff --git a/src/include/drv/contec6464.c b/src/include/drv/contec6464.c index 62bbf7f0a89833bef55edccb41d3700a26cd08e4..342edf6b35f70170eafa44c24deb5bf3d9e64b4a 100644 --- a/src/include/drv/contec6464.c +++ b/src/include/drv/contec6464.c @@ -5,7 +5,8 @@ ///< href="http://www.contec.com/product.php?id=1710">DIO-6464L-PE Manual</a> #include "contec6464.h" -#include "util/printl.h" +#include "drv/rts-logger.h" + // ***************************************************************************** /// \brief Routine to initialize CONTEC PCIe 6464 DIO module @@ -34,14 +35,14 @@ contec6464Init( CDS_HARDWARE* pHardware, struct pci_dev* diodev ) pedStatus = pci_enable_device( diodev ); /// Find the I/O address space for this module. pci_read_config_dword( diodev, PCI_BASE_ADDRESS_0, &pci_io_addr ); - printl( "contec 6464 dio pci2 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "contec 6464 dio pci2 = 0x%x\n", pci_io_addr ); pHardware->pci_do[ devNum ] = pci_io_addr - 1; - printl( "contec32L diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); + RTSLOG_INFO( "contec32L diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); /// Read board number switch setting on module pci_read_config_dword( diodev, PCI_REVISION_ID, &id ); - printl( "contec dio pci2 card number= 0x%x\n", ( id & 0xf ) ); + RTSLOG_INFO( "contec dio pci2 card number= 0x%x\n", ( id & 0xf ) ); test = contec6464ReadInputRegister( pHardware,devNum); - printl("Contec6464 %d read = 0x%x\n",devNum,test); + RTSLOG_INFO("Contec6464 %d read = 0x%x\n",devNum,test); /// Break the module into two, 32bit devices ie 64bits will not carry thru /// read/write and ///< maintain all of the bit information. @@ -57,9 +58,9 @@ contec6464Init( CDS_HARDWARE* pHardware, struct pci_dev* diodev ) pHardware->doCount++; pHardware->doInstance[ devNum ] = pHardware->card_count[ CON_6464DIO ]; pHardware->card_count[ CON_6464DIO ] ++; - printl( "contec32H diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); + RTSLOG_INFO("contec32H diospace = 0x%x\n", pHardware->pci_do[ devNum ] ); test = contec6464ReadInputRegister( pHardware,devNum); - printl("Contec6464 %d read = 0x%x\n",devNum,test); + RTSLOG_INFO("Contec6464 %d read = 0x%x\n",devNum,test); /// Return board ID number. return ( id ); } diff --git a/src/include/drv/daqLib.c b/src/include/drv/daqLib.c index 89f4afd578a70e7c04b94855d98d98650dc540b4..027a70c62a9ea91789c68911d85203198c93fd06 100644 --- a/src/include/drv/daqLib.c +++ b/src/include/drv/daqLib.c @@ -463,7 +463,6 @@ daqWrite( int flag, validTp = 0; validTpNet = 0; - // printl("at connect TPnum[0]=%d\n", tpNum[0]); } /// End DAQ CONNECT INITIALIZATION ****************************** /* ******************************************************************************** @@ -667,7 +666,6 @@ daqWrite( int flag, { kk = jj + DAQ_XFER_FMD_PER_CYCLE; } - // printl("Cycle = %d jj = %d kk = %d\n",daqSlot,jj,kk); for ( ii = jj; ii < kk; ii++ ) { *pEpicsFloat = (float)dspPtr->inputs[ ii ].offset; @@ -794,7 +792,6 @@ daqWrite( int flag, // - -- Check for reconfig request at start of each second if ( ( pInfo->reconfig == 1 ) && ( daqBlockNum == 0 ) ) { - // printl("New daq config\n"); pInfo->reconfig = 0; // Configure EPICS data channels xferInfo.crcLength = daqConfig( &dataInfo, pInfo, pEpics ); @@ -885,7 +882,6 @@ daqWrite( int flag, ii = i - DAQ_GDS_MAX_TP_ALLOWED; } - // printl("tpn=%d at %d\n", tpn, i); slot = empty_slot( tpNum ); if ( slot < 0 ) { @@ -1065,7 +1061,6 @@ daqConfig( volatile DAQ_INFO_BLOCK* dataInfo, // if((status < 1) || (status > DCU_MAX_CHANNELS)) if ( status > DCU_MAX_CHANNELS ) { - // printl("Invalid num daq chans = %d\n",status); return ( -1 ); } @@ -1099,8 +1094,6 @@ daqConfig( volatile DAQ_INFO_BLOCK* dataInfo, ii = ( sizeof( CDS_EPICS_OUT ) / 4 ); jj = dataInfo->numEpicsInts - ii; - // printl("Have %d CDS epics integer and %d USR epics integer - // channels\n",ii,jj); ii *= 4; jj *= 4; @@ -1111,12 +1104,10 @@ daqConfig( volatile DAQ_INFO_BLOCK* dataInfo, /// before the double type data in shared memory. if ( ii % 8 ) { - // printl("Have int mem hole after CDS %d %d \n",ii,jj); dataInfo->epicsdblDataOffset += 4; } if ( jj % 8 ) { - // printl("Have int mem hole after user %d %d \n",ii,jj); dataInfo->epicsdblDataOffset += 4; } if ( ( ii % 8 ) && ( jj > 0 ) ) @@ -1129,9 +1120,6 @@ daqConfig( volatile DAQ_INFO_BLOCK* dataInfo, dataInfo->cpyIntSize[ 1 ] = jj; dataInfo->cpyepics2times = 1; // dataInfo->epicsdblDataOffset += 4; - // printl("Have mem holes after CDS %d %d \nNeed to cpy ints twice - - // size 1 = %d size 2 = %d - // \n",ii,jj,dataInfo->cpyIntSize[0],dataInfo->cpyIntSize[1]); } /// \> Set the pointer to start of EPICS double type data in shared memory. @@ -1142,17 +1130,7 @@ daqConfig( volatile DAQ_INFO_BLOCK* dataInfo, ( pEpicsIntData + epicsIntXferSize + dataInfo->epicsdblDataOffset ); // Send EPICS data diags to dmesg - // printl("DAQ EPICS INT DATA is at 0x%lx with size - // %d\n",(long)pEpicsIntData,epicsIntXferSize); - // printl("DAQ EPICS FLT DATA is at 0x%lx\n",(long)pEpicsDblData); - // printl("DAQ EPICS: Int = %d Flt = %d Filters = %d Total = %d Fast = - // %d\n",dataInfo->numEpicsInts,dataInfo->numEpicsFloats,dataInfo->numEpicsFilts, - // dataInfo->numEpicsTotal, dataInfo->numChans); - // printl("DAQ EPICS: Number of Filter Module Xfers = %d last = - // %d\n",dataInfo->numEpicsFiltXfers,dataInfo->numEpicsFiltsLast); - /// \> Initialize CRC length with EPICS data size. dataLength = 4 * dataInfo->numEpicsTotal; - // printl("crc length epics = %d\n",dataLength); /// \> Get the DAQ configuration information for all fast DAQ channels and /// calc a crc checksum length @@ -1164,8 +1142,6 @@ daqConfig( volatile DAQ_INFO_BLOCK* dataInfo, mydatatype = dataInfo->tp[ ii ].dataType; dataLength += DAQ_DATA_TYPE_SIZE( mydatatype ) * dataInfo->tp[ ii ].dataRate / DAQ_NUM_DATA_BLOCKS; - // if(mydatatype == 5) printl("Found double - // %d\n",DAQ_DATA_TYPE_SIZE(mydatatype)); } /// \> Set DAQ bytes/sec global, which is output to EPICS by controller.c curDaqBlockSize = dataLength * DAQ_NUM_DATA_BLOCKS_PER_SECOND; @@ -1220,8 +1196,6 @@ loadLocalTable( DAQ_XFER_INFO* pDxi, if ( ( dataInfo->tp[ ii ].dataRate / DAQ_NUM_DATA_BLOCKS ) > sysRate ) { /* Channel data rate is greater than system rate */ - // printl("Channels %d has bad data rate %d\n", ii, - // dataInfo->tp[ii].dataRate); return ( -1 ); } else @@ -1287,12 +1261,8 @@ loadLocalTable( DAQ_XFER_INFO* pDxi, } else { - // printl("Invalid chan num found %d = - // %d\n",ii,dataInfo->tp[ii].tpnum); return ( -1 ); } - // printl("Table %d Offset = %d Type = - // %d\n",ii,localTable[ii].offset,dataInfo->tp[ii].dataType); } return ( 0 ); /// \> RETURN 0=OK or -1=FAIL diff --git a/src/include/drv/fm10Gen.c b/src/include/drv/fm10Gen.c index c99a47c51c72918830615113051d8496215a0e9c..74b213725c30706e2c388bd9abab871dfe3ceeac 100644 --- a/src/include/drv/fm10Gen.c +++ b/src/include/drv/fm10Gen.c @@ -171,12 +171,12 @@ readCoefVme2( COEF* filtC, #ifdef FIR_FILTERS if ( type < 0 || type > MAX_FIR_MODULES ) { - // printl("Vme2 bad Epics filter type: module=%d filter=%d + // RTSLOG_ERROR("Vme2 bad Epics filter type: module=%d filter=%d // filterType=%d\n", modNum1, filtNum, type); } #endif - // printl("readCoefVme2: module=%d filter=%d filterType=%d\n", modNum1, + // RTSLOG_INFO("readCoefVme2: module=%d filter=%d filterType=%d\n", modNum1, // filtNum, type); ii = 0; @@ -190,7 +190,7 @@ readCoefVme2( COEF* filtC, localCoeff.crc = crc_ptr( (char*)&ii, sizeof( int ), localCoeff.crc ); if ( ( ( ii > 0 ) && ( ii < 11 ) ) || ( ( ii > 10 ) && ( type > 0 ) ) ) { - // printl("vme2: module=%d filter=%d type=%d\n", modNum1, filtNum, + // RTSLOG_DEBUG("vme2: module=%d filter=%d type=%d\n", modNum1, filtNum, // type); localCoeff.filtSections[ filtNum ] = ii; localCoeff.filterType[ filtNum ] = type; @@ -213,7 +213,7 @@ readCoefVme2( COEF* filtC, } else { - // printl("vme2:off module=%d filter=%d type=%d\n", modNum1, + // DEBUG("vme2:off module=%d filter=%d type=%d\n", modNum1, // filtNum, type); /* Turn filter status readback off */ fmt->inputs[ modNum1 ].opSwitchP &= ~pow2_out[ filtNum ]; @@ -239,7 +239,6 @@ readCoefVme2( COEF* filtC, localFirFiltCoeff[ filtNum ][ 0 ] = temp; localCoeff.crc = crc_ptr( (char*)&temp, sizeof( double ), localCoeff.crc ); - // printl("gain = %f\n", temp); #endif } else @@ -275,7 +274,6 @@ readCoefVme2( COEF* filtC, localFirFiltCoeff[ filtNum ][ kk ] = temp; localCoeff.crc = crc_ptr( (char*)&temp, sizeof( double ), localCoeff.crc ); - // printl("%f ", temp); #endif } else @@ -294,7 +292,6 @@ readCoefVme2( COEF* filtC, localCoeff.crc ); } } - // if (type > 0) printl("\n"); if ( localCoeff.filtSections[ filtNum ] > cycle ) ii = cycle + 1; else @@ -309,7 +306,7 @@ readCoefVme2( COEF* filtC, unsigned int vme_crc = pRfmCoeff->vmeCoeffs[ modNum1 ].crc; if ( localCoeff.crc != vme_crc ) { - // printl("vme_crc = 0x%x; local crc = 0x%x\n", vme_crc, + // RTSLOG_ERROR("vme_crc = 0x%x; local crc = 0x%x\n", vme_crc, // localCoeff.crc); return -1; } } @@ -420,7 +417,6 @@ checkFiltResetId( int bankNum, /* Coeff reset in progress */ if ( filtResetId[ id ].fmResetDsp == pL ) { /* Coeff reset is done for this subsystem */ - /* printl("Coeff reset done\n"); */ filtResetId[ id ].fmSubCounter = readCoefVme2( pC, pL, @@ -442,8 +438,6 @@ checkFiltResetId( int bankNum, { filtResetId[ id ].fmResetCounter = 0; dspVme->coef_load_error = filtResetId[ id ].fmResetCoeff; - /* printl("dspVme->coef_load_error = %d\n", - * dspVme->coef_load_error ); */ filtResetId[ id ].fmResetCoeff = 0; } } @@ -489,7 +483,7 @@ checkFiltResetId( int bankNum, /* Check if new coeffs */ if ( status & 1 ) { - /* printl("New coeff request; bank=%d \n", bankNum); */ + /* RTSLOG_DEBUG("New coeff request; bank=%d \n", bankNum); */ filtResetId[ id ].fmResetCoeff = bankNum + 1; filtResetId[ id ].fmResetDsp = pL; } @@ -758,8 +752,6 @@ filterModuleD2( FILT_MOD* pFilt, /* Filter module data */ #ifdef SERVO4K int firNum = ( cycleNum / 32 ) % 64; #endif - // int firNum = cycleNum % 32; - // printl("cycleNum=%d; firNum=%d\n", cycleNum, firNum); /* FIR filter */ --filterType; @@ -783,8 +775,6 @@ filterModuleD2( FILT_MOD* pFilt, /* Filter module data */ else { filtData = filterType; - // printl("module %d; filter %d; filterType = %d\n", modNum, - // ii, filterType); } } } @@ -825,8 +815,6 @@ filterModuleD2( FILT_MOD* pFilt, /* Filter module data */ ramp = pFilt->inputs[ modNum ] .rmpcmp[ ii ]; /* Ramp slope coefficient */ kk = pFilt->inputs[ modNum ].cnt[ ii ]; /* Ramp count */ - /* printl("kk=%d; ramp=%d; sw=%d; sw_out=%d\n", kk, ramp, sw, - * sw_out); */ if ( kk == ramp ) { /* Done ramping */ diff --git a/src/include/drv/gsc16ai64.c b/src/include/drv/gsc16ai64.c index 569ea0ec578926074dff9f119f77e30163dbd0d3..9ad3f6d623c356ff2b08a3c724728a56e2ddde74 100644 --- a/src/include/drv/gsc16ai64.c +++ b/src/include/drv/gsc16ai64.c @@ -12,7 +12,8 @@ #include "gsc_adc_common.h" #include "ioremap_selection.h" #include "drv/plx_9056.h" //adcDma -#include "util/printl.h" +#include "drv/rts-logger.h" + #include <linux/pci.h> //PCI_BASE_ADDRESS_0 #include <linux/delay.h> //udelay() @@ -54,7 +55,7 @@ gsc16ai64Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) #endif if(pedStatus != 0) return -1; - printl( "pci0 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "pci0 = 0x%x\n", pci_io_addr ); /// Map module DMA space directly to computer memory space. _adc_add = IOREMAP( (unsigned long)pci_io_addr, 0x200 ); /// Map the module DMA control registers via PLX chip registers @@ -64,14 +65,14 @@ gsc16ai64Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) pedStatus = pci_read_config_dword( adcdev, PCI_BASE_ADDRESS_2, &pci_io_addr ); if(pedStatus != 0) return -1; - printl( "pci2 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "pci2 = 0x%x\n", pci_io_addr ); /// Map the module control register so local memory space. _adc_add = IOREMAP( (unsigned long)pci_io_addr, 0x200 ); - printl( "ADC I/O address=0x%x 0x%lx\n", pci_io_addr, (long)_adc_add ); + RTSLOG_INFO( "ADC I/O address=0x%x 0x%lx\n", pci_io_addr, (long)_adc_add ); /// Set global ptr to control register memory space. _adcPtr[ devNum ] = (GSA_ADC_REG*)_adc_add; - printl( "BCR = 0x%x\n", _adcPtr[ devNum ]->BCR ); + RTSLOG_INFO( "BCR = 0x%x\n", _adcPtr[ devNum ]->BCR ); /// Reset the ADC board _adcPtr[ devNum ]->BCR |= GSAI_RESET; do @@ -94,8 +95,8 @@ gsc16ai64Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) /// This is used for Cymac using ADC internal clock _adcPtr[ devNum ]->RAG = (unsigned int)( GSC16AI64_OSC_FREQ / ( UNDERSAMPLE * IOP_IO_RATE ) ); - printl( "RAG = %d \n", _adcPtr[ devNum ]->RAG ); - printl( "BCR = 0x%x\n", _adcPtr[ devNum ]->BCR ); + RTSLOG_INFO( "RAG = %d \n", _adcPtr[ devNum ]->RAG ); + RTSLOG_INFO( "BCR = 0x%x\n", _adcPtr[ devNum ]->BCR ); _adcPtr[ devNum ]->RAG &= ~( GSAI_SAMPLE_START ); /// Initiate board calibration _adcPtr[ devNum ]->BCR |= GSAI_AUTO_CAL; @@ -107,12 +108,12 @@ gsc16ai64Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) } while ( ( _adcPtr[ devNum ]->BCR & GSAI_AUTO_CAL ) != 0 ); if ( ( _adcPtr[ devNum ]->BCR & GSAI_AUTO_CAL_PASS ) == 0 ) { - printl( "ADC AUTOCAL FAIL %d\n", autocal ); + RTSLOG_ERROR( "ADC AUTOCAL FAIL %d\n", autocal ); autocal = 0; } else { - printl( "ADC AUTOCAL PASS %d\n", autocal ); + RTSLOG_INFO( "ADC AUTOCAL PASS %d\n", autocal ); autocal = GSAI_AUTO_CAL_PASS; } _adcPtr[ devNum ]->RAG |= GSAI_SAMPLE_START; @@ -122,12 +123,13 @@ gsc16ai64Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) #else _adcPtr[ devNum ]->SSC = ( GSAI_64_CHANNEL | GSAI_EXTERNAL_SYNC ); #endif - printl( "SSC = 0x%x\n", _adcPtr[ devNum ]->SSC ); - printl( "IDBC = 0x%x\n", _adcPtr[ devNum ]->IDBC ); + RTSLOG_INFO( "SSC = 0x%x\n", _adcPtr[ devNum ]->SSC ); + RTSLOG_INFO( "IDBC = 0x%x\n", _adcPtr[ devNum ]->IDBC ); /// Fill in CDS_HARDWARE structure with ADC information. pHardware->pci_adc[ devNum ] = (volatile int *)pci_alloc_consistent( adcdev, 0x2000, &adc_dma_handle[ devNum ] ); pHardware->adcType[ devNum ] = GSC_16AI64SSA; + pHardware->adcDuoToneDivisor[ devNum ] = 1; pHardware->adcInstance[ devNum ] = pHardware->card_count[ GSC_16AI64SSA ]; pHardware->card_count[ GSC_16AI64SSA ] ++; pHardware->adcChannels[ devNum ] = GSAI_CHAN_COUNT; diff --git a/src/include/drv/gsc16ao16.c b/src/include/drv/gsc16ao16.c index a3540ecf00f18566d548f0093f65cb7bdbe9721c..9b680402c313dc77f8a04589f200a391d7f46551 100644 --- a/src/include/drv/gsc16ao16.c +++ b/src/include/drv/gsc16ao16.c @@ -13,7 +13,8 @@ #include "ioremap_selection.h" #include "drv/plx_9056.h" #include "drv/map.h" -#include "util/printl.h" +#include "drv/rts-logger.h" + // ***************************************************************************** /// \brief Routine to initialize GSC 16AO16 DAC modules. @@ -46,7 +47,7 @@ gsc16ao16Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) pedStatus = pci_read_config_dword( dacdev, PCI_BASE_ADDRESS_0, &pci_io_addr ); if(pedStatus != 0) return -1; - printl( "pci0 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "pci0 = 0x%x\n", pci_io_addr ); _dac_add = IOREMAP( (unsigned long)pci_io_addr, 0x200 ); /// Set up a pointer to DMA registers on PLX chip dacDma[ devNum ] = (PLX_9056_DMA*)_dac_add; @@ -55,12 +56,12 @@ gsc16ao16Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) pedStatus = pci_read_config_dword( dacdev, PCI_BASE_ADDRESS_2, &pci_io_addr ); if(pedStatus != 0) return -1; - printl( "dac pci2 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "dac pci2 = 0x%x\n", pci_io_addr ); _dac_add = IOREMAP( (unsigned long)pci_io_addr, 0x200 ); - printl( "DAC I/O address=0x%x 0x%lx\n", pci_io_addr, (long)_dac_add ); + RTSLOG_INFO( "DAC I/O address=0x%x 0x%lx\n", pci_io_addr, (long)_dac_add ); _dacPtr[ devNum ] = (GSC_DAC_REG*)_dac_add; - printl( "DAC BCR = 0x%x\n", _dacPtr[ devNum ]->BCR ); + RTSLOG_INFO( "DAC BCR = 0x%x\n", _dacPtr[ devNum ]->BCR ); /// Reset the DAC board and wait for it to finish (3msec) _dacPtr[ devNum ]->BCR |= GSAO_RESET; @@ -70,20 +71,21 @@ gsc16ao16Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) /// Enable 2s complement by clearing offset binary bit _dacPtr[ devNum ]->BCR = ( GSAO_OUT_RANGE_10 | GSAO_SIMULT_OUT ); - printl( "DAC BCR after init = 0x%x\n", _dacPtr[ devNum ]->BCR ); - printl( "DAC CSR = 0x%x\n", _dacPtr[ devNum ]->CSR_DIO ); - printl( "DAC SRR = 0x%x\n", _dacPtr[ devNum ]->SAMPLE_RATE ); + RTSLOG_INFO( "DAC BCR after init = 0x%x\n", _dacPtr[ devNum ]->BCR ); + RTSLOG_INFO( "DAC CSR = 0x%x\n", _dacPtr[ devNum ]->CSR_DIO ); + RTSLOG_INFO( "DAC SRR = 0x%x\n", _dacPtr[ devNum ]->SAMPLE_RATE ); /// Set DAC FIFO buffer size. Set to match DAC timing diagnostics. _dacPtr[ devNum ]->BOR = GSAO_FIFO_SIZE; #ifndef USE_ADC_CLOCK _dacPtr[ devNum ]->BOR |= GSAO_EXTERN_CLK; #endif - printl( "DAC BOR = 0x%x\n", _dacPtr[ devNum ]->BOR ); + RTSLOG_INFO( "DAC BOR = 0x%x\n", _dacPtr[ devNum ]->BOR ); pHardware->pci_dac[ devNum ] = (volatile int *)pci_alloc_consistent( dacdev, 0x200, &dac_dma_handle[ devNum ] ); pHardware->dacAcr[ devNum ] = (int)( _dacPtr[ devNum ]->ASSC ); pHardware->dacType[ devNum ] = GSC_16AO16; + pHardware->dacDuoToneMultiplier[ devNum ] = 1; pHardware->dacCount++; pHardware->dacInstance[ devNum ] = pHardware->card_count[ GSC_16AO16 ]; pHardware->card_count[ GSC_16AO16 ] ++; diff --git a/src/include/drv/gsc18ai32.c b/src/include/drv/gsc18ai32.c index 46ebd212e4f54911409b6c22c41e314e3c1c4953..3dadefaf82d814a62b143598c9680ecda33588f3 100644 --- a/src/include/drv/gsc18ai32.c +++ b/src/include/drv/gsc18ai32.c @@ -8,7 +8,7 @@ #include "gsc18ai32.h" #include "ioremap_selection.h" #include "drv/plx_9056.h" -#include "util/printl.h" +#include "drv/rts-logger.h" #include <linux/delay.h> //udelay() @@ -47,7 +47,7 @@ gsc18ai32Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) pedStatus = pci_read_config_dword( adcdev, PCI_BASE_ADDRESS_0, &pci_io_addr ); if(pedStatus != 0) return -1; - printl( "pci0 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "pci0 = 0x%x\n", pci_io_addr ); /// Map module DMA space directly to computer memory space. _adc_add = IOREMAP( (unsigned long)pci_io_addr, 0x200 ); /// Map the module DMA control registers via PLX chip registers @@ -57,16 +57,16 @@ gsc18ai32Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) pedStatus = pci_read_config_dword( adcdev, PCI_BASE_ADDRESS_2, &pci_io_addr ); if(pedStatus != 0) return -1; - printl( "pci2 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "pci2 = 0x%x\n", pci_io_addr ); /// Map the module control register so local memory space. _adc_add = IOREMAP( (unsigned long)pci_io_addr, 0x200 ); - printl( "ADC 18 I/O address=0x%x 0x%lx\n", pci_io_addr, (long)_adc_add ); + RTSLOG_INFO( "ADC 18 I/O address=0x%x 0x%lx\n", pci_io_addr, (long)_adc_add ); /// Set global ptr to control register memory space. adc18Ptr = (GSA_ADC_REG*)_adc_add; _adcPtr[ devNum ] = (GSA_ADC_REG*)_adc_add; - printl( "ADC pointer init at 0x%lx\n", (long)_adcPtr[ devNum ] ); + RTSLOG_INFO( "ADC pointer init at 0x%lx\n", (long)_adcPtr[ devNum ] ); - printl( "BCR = 0x%x\n", adc18Ptr->BCR ); + RTSLOG_INFO( "BCR = 0x%x\n", adc18Ptr->BCR ); /// Reset the ADC board adc18Ptr->BCR |= GSAF_RESET; do @@ -81,8 +81,8 @@ gsc18ai32Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) /// Unit runs with external clock, so this probably not necessary adc18Ptr->RAG = (unsigned int)( GSC18AI32_OSC_FREQ / ( UNDERSAMPLE * IOP_IO_RATE ) ); - printl( "RAG = %d \n", adc18Ptr->RAG ); - printl( "BCR = 0x%x\n", adc18Ptr->BCR ); + RTSLOG_INFO( "RAG = %d \n", adc18Ptr->RAG ); + RTSLOG_INFO( "BCR = 0x%x\n", adc18Ptr->BCR ); adc18Ptr->RAG &= ~( GSAF_SAMPLE_START ); // 0x10000 /// Initiate board calibration @@ -95,12 +95,12 @@ gsc18ai32Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) } while ( ( adc18Ptr->BCR & GSAF_AUTO_CAL ) != 0 ); // 0x2000 if ( ( adc18Ptr->BCR & GSAF_AUTO_CAL_PASS ) == 0 ) { - printl( "ADC AUTOCAL FAIL %d\n", autocal ); + RTSLOG_INFO( "ADC AUTOCAL FAIL %d\n", autocal ); autocal = 0; } else { - printl( "ADC AUTOCAL PASS %d\n", autocal ); + RTSLOG_INFO( "ADC AUTOCAL PASS %d\n", autocal ); autocal = GSAF_AUTO_CAL_PASS; } // End AutoCal @@ -135,12 +135,13 @@ gsc18ai32Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) // Only for Cymacs using ADC internal clock as clock source adc18Ptr->SSC |= GSAF_USE_RAG_CLK; #endif - printl( "SSC = 0x%x\n", adc18Ptr->SSC ); - printl( "IDBC = 0x%x\n", adc18Ptr->IDBC ); + RTSLOG_INFO( "SSC = 0x%x\n", adc18Ptr->SSC ); + RTSLOG_INFO( "IDBC = 0x%x\n", adc18Ptr->IDBC ); /// Fill in CDS_HARDWARE structure with ADC information. pHardware->pci_adc[ devNum ] = (volatile int *)pci_alloc_consistent( adcdev, 0x2000, &adc_dma_handle[ devNum ] ); pHardware->adcType[ devNum ] = GSC_18AI32SSC1M; + pHardware->adcDuoToneDivisor[ devNum ] = 4; pHardware->adcInstance[ devNum ] = pHardware->card_count[ GSC_18AI32SSC1M ]; pHardware->card_count[ GSC_18AI32SSC1M ] ++; pHardware->adcConfig[ devNum ] |= autocal; diff --git a/src/include/drv/gsc18ai64.c b/src/include/drv/gsc18ai64.c index 75cc05296dd585631d1dabba3f5f87af00549e98..620bbed021ecbbaac938f233caab3f85b7043671 100644 --- a/src/include/drv/gsc18ai64.c +++ b/src/include/drv/gsc18ai64.c @@ -8,7 +8,8 @@ #include "gsc18ai64.h" #include "ioremap_selection.h" #include "drv/plx_9056.h" -#include "util/printl.h" +#include "drv/rts-logger.h" + #include <linux/delay.h> //udelay() @@ -47,7 +48,7 @@ gsc18ai64Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) pedStatus = pci_read_config_dword( adcdev, PCI_BASE_ADDRESS_0, &pci_io_addr ); if(pedStatus != 0) return -1; - printl( "pci0 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "pci0 = 0x%x\n", pci_io_addr ); /// Map module DMA space directly to computer memory space. _adc_add = IOREMAP( (unsigned long)pci_io_addr, 0x200 ); /// Map the module DMA control registers via PLX chip registers @@ -57,15 +58,15 @@ gsc18ai64Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) pedStatus = pci_read_config_dword( adcdev, PCI_BASE_ADDRESS_2, &pci_io_addr ); if(pedStatus != 0) return -1; - printl( "pci2 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "pci2 = 0x%x\n", pci_io_addr ); /// Map the module control register so local memory space. _adc_add = IOREMAP( (unsigned long)pci_io_addr, 0x200 ); - printl( "ADC I/O address=0x%x 0x%lx\n", pci_io_addr, (long)_adc_add ); + RTSLOG_INFO( "ADC I/O address=0x%x 0x%lx\n", pci_io_addr, (long)_adc_add ); /// Set global ptr to control register memory space. adc18Ptr = (GSA_ADC_REG*)_adc_add; _adcPtr[ devNum ] = (GSA_ADC_REG*)_adc_add; - printl( "BCR = 0x%x\n", _adcPtr[ devNum ]->BCR ); + RTSLOG_INFO( "BCR = 0x%x\n", _adcPtr[ devNum ]->BCR ); /// Reset the ADC board adc18Ptr->BCR |= GSA7_RESET; do @@ -83,8 +84,8 @@ gsc18ai64Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) /// Unit runs with external clock, so this probably not necessary adc18Ptr->RAG = (unsigned int)( GSC18AI64_OSC_FREQ / ( UNDERSAMPLE * IOP_IO_RATE ) ); - printl( "RAG = 0x%x\n", adc18Ptr->RAG ); - printl( "BCR = 0x%x\n", adc18Ptr->BCR ); + RTSLOG_INFO( "RAG = 0x%x\n", adc18Ptr->RAG ); + RTSLOG_INFO( "BCR = 0x%x\n", adc18Ptr->BCR ); adc18Ptr->RAG &= ~( GSA7_SAMPLE_START ); /// Initiate board calibration adc18Ptr->BCR |= GSA7_AUTO_CAL; @@ -96,12 +97,12 @@ gsc18ai64Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) } while ( ( adc18Ptr->BCR & GSA7_AUTO_CAL ) != 0 ); if ( ( adc18Ptr->BCR & GSA7_AUTO_CAL_PASS ) == 0 ) { - printl( "ADC AUTOCAL FAIL %d\n", autocal ); + RTSLOG_INFO( "ADC AUTOCAL FAIL %d\n", autocal ); autocal = 0; } else { - printl( "ADC AUTOCAL PASS %d\n", autocal ); + RTSLOG_INFO( "ADC AUTOCAL PASS %d\n", autocal ); autocal = GSA7_AUTO_CAL_PASS; } adc18Ptr->IDBC = ( GSAI_CLEAR_BUFFER | GSAI_THRESHOLD ); @@ -124,14 +125,15 @@ gsc18ai64Init( CDS_HARDWARE* pHardware, struct pci_dev* adcdev ) } // print diags to dmesg - printl( "750K SSC = 0x%x\n", adc18Ptr->SSC ); - printl( "750K IDBC = 0x%x\n", adc18Ptr->IDBC ); - printl( "750K PCR = 0x%x \n", adc18Ptr->ASSC ); + RTSLOG_INFO( "750K SSC = 0x%x\n", adc18Ptr->SSC ); + RTSLOG_INFO( "750K IDBC = 0x%x\n", adc18Ptr->IDBC ); + RTSLOG_INFO( "750K PCR = 0x%x \n", adc18Ptr->ASSC ); /// Fill in CDS_HARDWARE structure with ADC information. pHardware->pci_adc[ devNum ] = (volatile int *)pci_alloc_consistent( adcdev, 0x2000, &adc_dma_handle[ devNum ] ); pHardware->adcType[ devNum ] = GSC_18AI64SSC; + pHardware->adcDuoToneDivisor[ devNum ] = 4; pHardware->adcInstance[ devNum ] = pHardware->card_count[ GSC_18AI64SSC ]; pHardware->card_count[ GSC_18AI64SSC ] ++; pHardware->adcConfig[ devNum ] = adc18Ptr->ASSC; @@ -174,37 +176,37 @@ gsc18ai64ReadRegisters( CDS_HARDWARE* pHardware, int modnum ) adc18Ptr = (volatile GSA_ADC_REG*)_adcPtr[ modnum ]; bcr_value = adc18Ptr->BCR; ii = bcr_value & 7; - printl( "750KHz BCR AIM = %d\n", ii ); + RTSLOG_INFO( "750KHz BCR AIM = %d\n", ii ); ii = ( bcr_value >> 3 ); - printl( "750KHz BCR Unipolar = %d\n", ( ii & 1 ) ); + RTSLOG_INFO( "750KHz BCR Unipolar = %d\n", ( ii & 1 ) ); ii = ( bcr_value >> 4 ); - printl( "750KHz BCR Range = %d\n", ( ii & 3 ) ); + RTSLOG_INFO( "750KHz BCR Range = %d\n", ( ii & 3 ) ); ii = ( bcr_value >> 6 ); - printl( "750KHz BCR Offset Binary = %d\n", ( ii & 1 ) ); + RTSLOG_INFO( "750KHz BCR Offset Binary = %d\n", ( ii & 1 ) ); ii = ( bcr_value >> 7 ); - printl( "750KHz BCR 16 Bit = %d\n", ( ii & 1 ) ); + RTSLOG_INFO( "750KHz BCR 16 Bit = %d\n", ( ii & 1 ) ); ii = ( bcr_value >> 8 ); - printl( "750KHz BCR Differential Processing = %d\n", ( ii & 3 ) ); + RTSLOG_INFO( "750KHz BCR Differential Processing = %d\n", ( ii & 3 ) ); ii = ( bcr_value >> 10 ); - printl( "750KHz BCR Data on Hold = %d\n", ( ii & 1 ) ); + RTSLOG_INFO( "750KHz BCR Data on Hold = %d\n", ( ii & 1 ) ); ii = ( bcr_value >> 11 ); - printl( "750KHz BCR Disable Scan Marker = %d\n", ( ii & 1 ) ); + RTSLOG_INFO( "750KHz BCR Disable Scan Marker = %d\n", ( ii & 1 ) ); ii = ( bcr_value >> 12 ); - printl( "750KHz BCR Burst Trigger = %d\n", ( ii & 1 ) ); + RTSLOG_INFO( "750KHz BCR Burst Trigger = %d\n", ( ii & 1 ) ); ii = ( bcr_value >> 13 ); - printl( "750KHz BCR Autocal = %d\n", ( ii & 1 ) ); + RTSLOG_INFO( "750KHz BCR Autocal = %d\n", ( ii & 1 ) ); ii = ( bcr_value >> 14 ); - printl( "750KHz BCR Autocal Pass = %d\n", ( ii & 1 ) ); + RTSLOG_INFO( "750KHz BCR Autocal Pass = %d\n", ( ii & 1 ) ); ii = ( bcr_value >> 15 ); - printl( "750KHz BCR Initialize = %d\n", ( ii & 1 ) ); + RTSLOG_INFO( "750KHz BCR Initialize = %d\n", ( ii & 1 ) ); ii = ( bcr_value >> 16 ); - printl( "750KHz BCR Buffer Underflow = %d\n", ( ii & 1 ) ); + RTSLOG_INFO( "750KHz BCR Buffer Underflow = %d\n", ( ii & 1 ) ); ii = ( bcr_value >> 17 ); - printl( "750KHz BCR Buffer Overflow = %d\n", ( ii & 1 ) ); + RTSLOG_INFO( "750KHz BCR Buffer Overflow = %d\n", ( ii & 1 ) ); ii = ( bcr_value >> 18 ); - printl( "750KHz BCR Data Packing = %d\n", ( ii & 1 ) ); + RTSLOG_INFO( "750KHz BCR Data Packing = %d\n", ( ii & 1 ) ); ii = ( bcr_value >> 19 ); - printl( "750KHz BCR Input Clock = %d\n", ( ii & 1 ) ); + RTSLOG_INFO( "750KHz BCR Input Clock = %d\n", ( ii & 1 ) ); } // ***************************************************************************** diff --git a/src/include/drv/gsc18ao8.c b/src/include/drv/gsc18ao8.c index f3e70d5e90054d838c7fbf988c4e7c0ac1373957..f4ac31e569cc42fa86d795715753ff612e3f7e5f 100644 --- a/src/include/drv/gsc18ao8.c +++ b/src/include/drv/gsc18ao8.c @@ -11,7 +11,7 @@ #include "drv/gsc_dac_common.h" #include "drv/gsc18ao8.h" #include "ioremap_selection.h" -#include "util/printl.h" +#include "drv/rts-logger.h" #include "drv/map.h" #include "drv/plx_9056.h" @@ -54,7 +54,7 @@ gsc18ao8Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) pedStatus = pci_read_config_dword( dacdev, PCI_BASE_ADDRESS_0, &pci_io_addr ); if(pedStatus != 0) return -1; - printl( "pci0 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "pci0 = 0x%x\n", pci_io_addr ); _dac_add = IOREMAP( (unsigned long)pci_io_addr, 0x200 ); /// Set up a pointer to DMA registers on PLX chip dacDma[ devNum ] = (PLX_9056_DMA*)_dac_add; @@ -63,14 +63,14 @@ gsc18ao8Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) pedStatus = pci_read_config_dword( dacdev, PCI_BASE_ADDRESS_2, &pci_io_addr ); if(pedStatus != 0) return -1; - printl( "dac pci2 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "dac pci2 = 0x%x\n", pci_io_addr ); _dac_add = IOREMAP( (unsigned long)pci_io_addr, 0x200 ); - printl( "DAC I/O address=0x%x 0x%lx\n", pci_io_addr, (long)_dac_add ); + RTSLOG_INFO( "DAC I/O address=0x%x 0x%lx\n", pci_io_addr, (long)_dac_add ); dac18bitPtr = (GSC_DAC_REG*)_dac_add; _dacPtr[ devNum ] = (GSC_DAC_REG*)_dac_add; - printl( "DAC BCR = 0x%x\n", dac18bitPtr->BCR ); + RTSLOG_INFO( "DAC BCR = 0x%x\n", dac18bitPtr->BCR ); /// Reset the DAC board and wait for it to finish (3msec) dac18bitPtr->BCR |= GSAO_18BIT_RESET; @@ -82,8 +82,8 @@ gsc18ao8Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) /// Enable 2s complement by clearing offset binary bit dac18bitPtr->BCR &= ~GSAO_18BIT_OFFSET_BINARY; dac18bitPtr->BCR |= GSAO_18BIT_SIMULT_OUT; - printl( "DAC BCR after init = 0x%x\n", dac18bitPtr->BCR ); - printl( "DAC OUTPUT CONFIG = 0x%x\n", dac18bitPtr->OUTPUT_CONFIG ); + RTSLOG_INFO( "DAC BCR after init = 0x%x\n", dac18bitPtr->BCR ); + RTSLOG_INFO( "DAC OUTPUT CONFIG = 0x%x\n", dac18bitPtr->OUTPUT_CONFIG ); /// Enable 10 volt output range dac18bitPtr->OUTPUT_CONFIG |= GSAO_18BIT_10VOLT_RANGE; @@ -105,16 +105,16 @@ gsc18ao8Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) if ( dac18bitPtr->BCR & GSAO_18BIT_AUTOCAL_PASS ) { - printl( "DAC AUTOCAL SUCCESS in %d milliseconds \n", timer ); + RTSLOG_INFO( "DAC AUTOCAL SUCCESS in %d milliseconds \n", timer ); pHardware->dacAcr[ devNum ] = DAC_CAL_PASS; } else { - printl( "DAC AUTOCAL FAILED in %d milliseconds \n", timer ); + RTSLOG_ERROR( "DAC AUTOCAL FAILED in %d milliseconds \n", timer ); } - printl( "DAC OUTPUT CONFIG after init = 0x%x with BCR = 0x%x\n", + RTSLOG_INFO( "DAC OUTPUT CONFIG after init = 0x%x with BCR = 0x%x\n", dac18bitPtr->OUTPUT_CONFIG, dac18bitPtr->BCR ); #else - printl( "DAC OUTPUT CONFIG after init = 0x%x\n", + RTSLOG_INFO( "DAC OUTPUT CONFIG after init = 0x%x\n", dac18bitPtr->OUTPUT_CONFIG ); #endif @@ -122,6 +122,7 @@ gsc18ao8Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) (volatile int *)pci_alloc_consistent( dacdev, 0x200, &dac_dma_handle[ devNum ] ); pHardware->dacAcr[ devNum ] |= ((int)( dac18bitPtr->ASY_CONFIG ) & DAC_ACR_MASK); pHardware->dacType[ devNum ] = GSC_18AO8; + pHardware->dacDuoToneMultiplier[ devNum ] = 4; pHardware->dacCount++; pHardware->dacInstance[ devNum ] = pHardware->card_count[ GSC_18AO8 ]; pHardware->card_count[ GSC_18AO8 ] ++; diff --git a/src/include/drv/gsc20ao8.c b/src/include/drv/gsc20ao8.c index 4b1e8cda8d5e60e2aa01061107b734d099dbebf5..54a6d4f5212fd1f72511089277c2a72f509a764f 100644 --- a/src/include/drv/gsc20ao8.c +++ b/src/include/drv/gsc20ao8.c @@ -11,7 +11,7 @@ #include "gsc_dac_common.h" #include "gsc20ao8.h" #include "ioremap_selection.h" -#include "util/printl.h" +#include "drv/rts-logger.h" #include "drv/plx_9056.h" #include "drv/map.h" @@ -52,7 +52,7 @@ gsc20ao8Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) pedStatus = pci_read_config_dword( dacdev, PCI_BASE_ADDRESS_0, &pci_io_addr ); if(pedStatus != 0) return -1; - printl( "pci0 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "pci0 = 0x%x\n", pci_io_addr ); _dac_add = IOREMAP( (unsigned long)pci_io_addr, 0x200 ); /// Set up a pointer to DMA registers on PLX chip dacDma[ devNum ] = (PLX_9056_DMA*)_dac_add; @@ -62,16 +62,16 @@ gsc20ao8Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) if(pedStatus != 0) return -1; // Send some info to dmesg - printl( "dac pci2 = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "dac pci2 = 0x%x\n", pci_io_addr ); _dac_add = IOREMAP( (unsigned long)pci_io_addr, 0x200 ); // Send some info to dmesg - printl( "DAC I/O address=0x%x 0x%lx\n", pci_io_addr, (long)_dac_add ); + RTSLOG_INFO( "DAC I/O address=0x%x 0x%lx\n", pci_io_addr, (long)_dac_add ); dac20bitPtr = (GSC_DAC_REG*)_dac_add; _dacPtr[ devNum ] = (GSC_DAC_REG*)_dac_add; // Send some info to dmesg - printl( "DAC BCR = 0x%x\n", dac20bitPtr->BCR ); + RTSLOG_INFO( "DAC BCR = 0x%x\n", dac20bitPtr->BCR ); /// Reset the DAC board and wait for it to finish (3msec) dac20bitPtr->BCR |= GSAO_20BIT_RESET; @@ -84,7 +84,7 @@ gsc20ao8Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) } while ( ( dac20bitPtr->BCR & GSAO_20BIT_RESET ) != 0 && timer > 0 && dac20bitPtr->PRIMARY_STATUS == 1 ); - // printl("DAC PSR after init = 0x%x and timer = + // RTSLOG_INFO("DAC PSR after init = 0x%x and timer = // %d\n",dac20bitPtr->PRIMARY_STATUS,timer); /// Enable 2s complement by clearing offset binary bit @@ -92,8 +92,8 @@ gsc20ao8Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) // Set simultaneous outputs dac20bitPtr->BCR |= GSAO_20BIT_SIMULT_OUT; // Send some info to dmesg - // printl("DAC BCR after init = 0x%x\n",dac20bitPtr->BCR); - // printl("DAC OUTPUT CONFIG = 0x%x\n",dac20bitPtr->OUTPUT_CONFIG); + // RTSLOG_INFO("DAC BCR after init = 0x%x\n",dac20bitPtr->BCR); + // RTSLOG_INFO("DAC OUTPUT CONFIG = 0x%x\n",dac20bitPtr->OUTPUT_CONFIG); /// Enable 10 volt output range dac20bitPtr->OUTPUT_CONFIG |= GSAO_20BIT_10VOLT_RANGE; @@ -103,10 +103,10 @@ gsc20ao8Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) dac20bitPtr->BCR |= GSAO_20BIT_OUTPUT_ENABLE; udelay( 1000 ); // Set primary status to detect autocal - printl( "DAC PSR = 0x%x\n", dac20bitPtr->PRIMARY_STATUS ); + RTSLOG_INFO( "DAC PSR = 0x%x\n", dac20bitPtr->PRIMARY_STATUS ); dac20bitPtr->PRIMARY_STATUS = 2; udelay( 1000 ); - printl( "DAC PSR after reset = 0x%x\n", dac20bitPtr->PRIMARY_STATUS ); + RTSLOG_INFO( "DAC PSR after reset = 0x%x\n", dac20bitPtr->PRIMARY_STATUS ); // Start Calibration dac20bitPtr->BCR |= GSAO_20BIT_AUTOCAL_SET; @@ -116,23 +116,22 @@ gsc20ao8Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) do { udelay( 1000 ); - // printl("DAC PSR in autocal = 0x%x\n",dac20bitPtr->PRIMARY_STATUS); timer += 1; } while ( ( dac20bitPtr->BCR & GSAO_20BIT_AUTOCAL_SET ) != 0 ); - printl( "DAC after autocal PSR = 0x%x\n", dac20bitPtr->PRIMARY_STATUS ); + RTSLOG_INFO( "DAC after autocal PSR = 0x%x\n", dac20bitPtr->PRIMARY_STATUS ); if ( dac20bitPtr->BCR & GSAO_20BIT_AUTOCAL_PASS ) { - printl( "DAC AUTOCAL SUCCESS in %d milliseconds \n", timer ); + RTSLOG_INFO( "DAC AUTOCAL SUCCESS in %d milliseconds \n", timer ); pHardware->dacAcr[ devNum ] = DAC_CAL_PASS; } else { - printl( "DAC AUTOCAL FAILED in %d milliseconds \n", timer ); + RTSLOG_ERROR( "DAC AUTOCAL FAILED in %d milliseconds \n", timer ); } - printl( "DAC PSR = 0x%x\n", dac20bitPtr->PRIMARY_STATUS ); + RTSLOG_INFO( "DAC PSR = 0x%x\n", dac20bitPtr->PRIMARY_STATUS ); // If 20bit DAC, need to enable outputs. dac20bitPtr->BCR |= GSAO_20BIT_OUTPUT_ENABLE; - printl( "DAC OUTPUT CONFIG after init = 0x%x with BCR = 0x%x\n", + RTSLOG_INFO( "DAC OUTPUT CONFIG after init = 0x%x with BCR = 0x%x\n", dac20bitPtr->OUTPUT_CONFIG, dac20bitPtr->BCR ); @@ -142,6 +141,7 @@ gsc20ao8Init( CDS_HARDWARE* pHardware, struct pci_dev* dacdev ) // Return the device type to main code. pHardware->dacType[ devNum ] = GSC_20AO8; + pHardware->dacDuoToneMultiplier[ devNum ] = 8; pHardware->dacCount++; pHardware->dacInstance[ devNum ] = pHardware->card_count[ GSC_20AO8 ]; pHardware->card_count[ GSC_20AO8 ] ++; diff --git a/src/include/drv/iop_dac_functions.c b/src/include/drv/iop_dac_functions.c index a219399201cb793f059106e9d66cf8a7cd2646fb..72d6b19216fdffc8043760605d065809989ec609 100644 --- a/src/include/drv/iop_dac_functions.c +++ b/src/include/drv/iop_dac_functions.c @@ -163,7 +163,8 @@ iop_dac_write( ) if ( ( dt_diag.dacDuoEnable ) && ( chan == ( num_outs - 1 ) ) && ( card == 0 ) ) { - dac_out = adcinfo.adcData[ 0 ][ ADC_DUOTONE_CHAN ]; + dac_out = adcinfo.adcData[ 0 ][ ADC_DUOTONE_CHAN ] + * cdsPciModules.dacDuoToneMultiplier[0] / cdsPciModules.adcDuoToneDivisor[0]; } // Code below is only for use in DAQ test system. #ifdef DIAG_TEST diff --git a/src/include/drv/ligoPcieTiming_core.c b/src/include/drv/ligoPcieTiming_core.c index a72c02bef0686a3e22abc2f018eeffda6081cb20..ff48ad840de89c0ed6bfc71dc957cb60dc4e6a81 100644 --- a/src/include/drv/ligoPcieTiming_core.c +++ b/src/include/drv/ligoPcieTiming_core.c @@ -2,7 +2,7 @@ /// \brief core functions for the LIGO timing card, init and read time #include "drv/ligoPcieTiming.h" #include "drv/ioremap_selection.h" -#include "util/printl.h" +#include "drv/rts-logger.h" #include <linux/delay.h> //udelay() @@ -30,11 +30,11 @@ lptcInit( CDS_HARDWARE* pCds, struct pci_dev* lptcdev ) card = pCds->card_count[ LPTC ]; status = pci_enable_device( lptcdev ); - printl( "Xilinx enabled status = %d\n", status ); + RTSLOG_INFO( "Xilinx enabled status = %d\n", status ); pci_read_config_dword( lptcdev, PCI_BASE_ADDRESS_0, &pci_io_addr ); pci_io_addr &= 0xfffffff0; addr = (char*)IOREMAP( (unsigned long)pci_io_addr, 0x2000 ); - printl( "Xilinx mapped = 0x%x 0x%p\n", pci_io_addr, addr ); + RTSLOG_INFO( "Xilinx mapped = 0x%x 0x%p\n", pci_io_addr, addr ); pCds->lptc[ card ] = (unsigned int*)addr; if ( card == 0 ) @@ -49,40 +49,40 @@ lptcInit( CDS_HARDWARE* pCds, struct pci_dev* lptcdev ) //usec = (gpstime & 0xffffffff) * LPTC_USEC_CONVERT; usec = lptc_usec_convert_int((uint32_t)(gpstime & 0xffffffff)); sec = (gpstime >> 32) & 0xffffffff; - printl( "Xilinx time1 = %u %u\n", sec, usec ); + RTSLOG_INFO( "Xilinx time1 = %u %u\n", sec, usec ); udelay(1000); gpstime = lptcPtr->gps_time; //usec = (gpstime & 0xffffffff) * LPTC_USEC_CONVERT; usec = lptc_usec_convert_int((int32_t)(gpstime & 0xffffffff)); sec = (gpstime >> 32) & 0xffffffff; - printl( "Xilinx time2 = %u %u\n", sec, usec ); + RTSLOG_INFO( "Xilinx time2 = %u %u\n", sec, usec ); - printl( "Xilinx status = 0x%x \n", lptcPtr->status ); - printl( "Xilinx sw revision = 0x%x \n", lptcPtr->revision ); - printl( "Xilinx bp config = 0x%x \n", lptcPtr->bp_config ); - printl( "Xilinx bp status = 0x%x \n", lptcPtr->bp_status ); + RTSLOG_INFO( "Xilinx status = 0x%x \n", lptcPtr->status ); + RTSLOG_INFO( "Xilinx sw revision = 0x%x \n", lptcPtr->revision ); + RTSLOG_INFO( "Xilinx bp config = 0x%x \n", lptcPtr->bp_config ); + RTSLOG_INFO( "Xilinx bp status = 0x%x \n", lptcPtr->bp_status ); regval = lptcPtr->status; if ( regval & LPTC_STATUS_OK ) - printl( "LPTC Status = OK\n" ); + RTSLOG_INFO( "LPTC Status = OK\n" ); else - printl( "LPTC Status = BAD \n" ); + RTSLOG_ERROR( "LPTC Status = BAD \n" ); if ( regval & LPTC_STATUS_UPLINK_OK ) - printl( "LPTC Uplink = OK\n" ); + RTSLOG_INFO( "LPTC Uplink = OK\n" ); else - printl( "LPTC Uplink = BAD \n" ); - printl( "LPTC Leap Seconds = %d\n", + RTSLOG_ERROR( "LPTC Uplink = BAD \n" ); + RTSLOG_INFO( "LPTC Leap Seconds = %d\n", ( ( regval & LPTC_STATUS_LEAP_SEC ) >> 8 ) ); - printl( "LPTC Leap Seconds = 0x%x\n", + RTSLOG_INFO( "LPTC Leap Seconds = 0x%x\n", ( ( regval & LPTC_STATUS_LEAP_SEC ) ) ); lptcPtr->bp_config = LPTC_CMD_STOP_CLK_ALL; msleep( 10 ); regval = lptcPtr->bp_status; if ( regval & LPTC_BPS_BP_PRESENT ) - printl( "LPTC backplane present = OK\n" ); + RTSLOG_INFO( "LPTC backplane present = OK\n" ); else - printl( "LPTC BACKPLANE IS NOT PRESENT \n" ); + RTSLOG_ERROR( "LPTC BACKPLANE IS NOT PRESENT \n" ); pCds->card_count[ LPTC ]++; return 0; } diff --git a/src/include/drv/rts-logger.h b/src/include/drv/rts-logger.h index 1c705da56cb15f9e5ae92930466640fc4e121c33..8ef5a27a7b46d10f32d8fa858d7e6c2b626b28b9 100644 --- a/src/include/drv/rts-logger.h +++ b/src/include/drv/rts-logger.h @@ -23,10 +23,13 @@ #if defined(FE_HEADER) #include FE_HEADER //SYSTEM_NAME_STRING_LOWER #define RTS_LOG_PREFIX SYSTEM_NAME_STRING_LOWER -#endif -#else +#else //FE_HEADER not defined, so define prefix as "undefined" + #define RTS_LOG_PREFIX "undefined" + +#endif //defined(FE_HEADER) + #endif //ifndef RTS_LOG_PREFIX enum RTSLOG_LOG_LEVEL diff --git a/src/include/drv/spectracomGPS.c b/src/include/drv/spectracomGPS.c index be44186165633bed55f1e2b01cbcd9389f953c4b..37f20418605458dbce87f0a17b89c393617baed6 100644 --- a/src/include/drv/spectracomGPS.c +++ b/src/include/drv/spectracomGPS.c @@ -11,8 +11,7 @@ #include "drv/spectracomGPS.h" #include "drv/ioremap_selection.h" #include "drv/cdsHardware.h" //CDS_HARDWARE -//#include "controller.h" //cdsPciModules //TODO: this should be a parameter -#include "util/printl.h" +#include "drv/rts-logger.h" #include <linux/pci.h> // PCI_BASE_ADDRESS_0 #include <linux/delay.h> //udelay() @@ -49,10 +48,10 @@ spectracomGpsInitCheckSync( CDS_HARDWARE* pHardware, pedStatus = pci_enable_device( gpsdev ); pci_read_config_dword( gpsdev, PCI_BASE_ADDRESS_0, &pci_io_addr ); pci_io_addr &= 0xfffffff0; - printl( "TSYNC PIC BASE 0 address = %x\n", pci_io_addr ); + RTSLOG_INFO( "TSYNC PIC BASE 0 address = 0x%x\n", pci_io_addr ); addr1 = (unsigned char*)IOREMAP( (unsigned long)pci_io_addr, 0x30 ); - printl( "Remapped 0x%p\n", addr1 ); + RTSLOG_INFO( "Remapped %p\n", addr1 ); pHardware->gps = (unsigned int*)addr1; pHardware->gpsType = TSYNC_RCVR; @@ -111,7 +110,7 @@ spectracomGpsInitCheckSync( CDS_HARDWARE* pHardware, i = myTime->BCD_SEC; if ( i < 1000000000 ) { - printl( "TSYNC NOT receiving YEAR info, defaulting to by year " + RTSLOG_INFO( "TSYNC NOT receiving YEAR info, defaulting to by year " "patch\n" ); *need_sync = 1; /* Historically we would hardwire a offset here. @@ -151,23 +150,23 @@ spectracomGpsInitCheckSync( CDS_HARDWARE* pHardware, else { *need_sync = 0; - printl( "TSYNC receiving YEAR info\n" ); + RTSLOG_INFO( "TSYNC receiving YEAR info\n" ); pHardware->gpsOffset = -315964800; } sec = i + pHardware->gpsOffset; i = myTime->BCD_SUB_SEC; - printl( "date = %d days %2d:%2d:%2d\n", days, hours, min, sec ); + RTSLOG_INFO( "date = %d days %2d:%2d:%2d\n", days, hours, min, sec ); usec = ( i & 0xf ) + ( ( i >> 4 ) & 0xf ) * 10 + ( ( i >> 8 ) & 0xf ) * 100; msec = ( ( i >> 16 ) & 0xf ) + ( ( i >> 20 ) & 0xf ) * 10 + ( ( i >> 24 ) & 0xf ) * 100; - printl( + RTSLOG_INFO( "bcd time = %d sec %d milliseconds %d microseconds %d nanosec\n", sec, msec, usec, nanosec ); - printl( "Board sync = %d\n", tsync ); + RTSLOG_INFO( "Board sync = %d\n", tsync ); } return ( 0 ); } diff --git a/src/include/drv/symmetricomGps.c b/src/include/drv/symmetricomGps.c index 0f3eda407cf60838f1bdbf8c843f8a65ed5402bc..1eca1220d3088ce628710ff41fce62a35133bddf 100644 --- a/src/include/drv/symmetricomGps.c +++ b/src/include/drv/symmetricomGps.c @@ -1,6 +1,6 @@ #include "drv/symmetricomGps.h" #include "drv/ioremap_selection.h" -#include "util/printl.h" +#include "drv/rts-logger.h" #include <asm/delay.h> @@ -24,10 +24,10 @@ symmetricomGpsInit( CDS_HARDWARE* pHardware, struct pci_dev* gpsdev ) pedStatus = pci_enable_device( gpsdev ); pci_read_config_dword( gpsdev, PCI_BASE_ADDRESS_2, &pci_io_addr ); pci_io_addr &= 0xfffffff0; - printl( "PIC BASE 2 address = %x\n", pci_io_addr ); + RTSLOG_INFO( "PIC BASE 2 address = %x\n", pci_io_addr ); addr1 = (unsigned char*)IOREMAP( (unsigned long)pci_io_addr, 0x40 ); - printl( "Remapped 0x%p\n", addr1 ); + RTSLOG_INFO( "Remapped 0x%p\n", addr1 ); pHardware->gps = (unsigned int*)addr1; pHardware->gpsType = SYMCOM_RCVR; timeReg = (SYMCOM_REGISTER*)addr1; @@ -37,8 +37,8 @@ symmetricomGpsInit( CDS_HARDWARE* pHardware, struct pci_dev* gpsdev ) pci_io_addr &= 0xfffffff0; addr3 = (unsigned char*)IOREMAP( (unsigned long)pci_io_addr, 0x200 ); - printl( "PIC BASE 3 address = 0x%x\n", pci_io_addr ); - printl( "PIC BASE 3 address = 0x%p\n", addr3 ); + RTSLOG_INFO( "PIC BASE 3 address = 0x%x\n", pci_io_addr ); + RTSLOG_INFO( "PIC BASE 3 address = 0x%p\n", addr3 ); dramRead = (unsigned int*)( addr3 + 0x82 ); cmd = (unsigned int*)( addr3 + 0x102 ); // @@ -54,8 +54,8 @@ symmetricomGpsInit( CDS_HARDWARE* pHardware, struct pci_dev* gpsdev ) i++; } while ( ( timeReg->ACK == 0 ) && ( i < 20 ) ); if ( timeReg->ACK ) - printl( "SysCom ack received ID %d !!! 0x%x\n", timeReg->ACK, i ); - printl( "Model = 0x%x\n", *dramRead ); + RTSLOG_INFO( "SysCom ack received ID %d !!! 0x%x\n", timeReg->ACK, i ); + RTSLOG_INFO( "Model = 0x%x\n", *dramRead ); // End Wait **************************************** // // Set write and wait ***************************** @@ -70,8 +70,8 @@ symmetricomGpsInit( CDS_HARDWARE* pHardware, struct pci_dev* gpsdev ) i++; } while ( ( timeReg->ACK == 0 ) && ( i < 20 ) ); if ( timeReg->ACK ) - printl( "SysCom ack received ID %d !!! 0x%x\n", timeReg->ACK, i ); - printl( "Model = 0x%x\n", *dramRead ); + RTSLOG_INFO( "SysCom ack received ID %d !!! 0x%x\n", timeReg->ACK, i ); + RTSLOG_INFO( "Model = 0x%x\n", *dramRead ); // End Wait **************************************** // // Set write and wait ***************************** @@ -86,8 +86,8 @@ symmetricomGpsInit( CDS_HARDWARE* pHardware, struct pci_dev* gpsdev ) i++; } while ( ( timeReg->ACK == 0 ) && ( i < 20 ) ); if ( timeReg->ACK ) - printl( "SysCom ack received ID %d !!! 0x%x\n", timeReg->ACK, i ); - printl( "Model = 0x%x\n", *dramRead ); + RTSLOG_INFO( "SysCom ack received ID %d !!! 0x%x\n", timeReg->ACK, i ); + RTSLOG_INFO( "Model = 0x%x\n", *dramRead ); // End Wait **************************************** // // Set write and wait ***************************** @@ -102,8 +102,8 @@ symmetricomGpsInit( CDS_HARDWARE* pHardware, struct pci_dev* gpsdev ) i++; } while ( ( timeReg->ACK == 0 ) && ( i < 20 ) ); if ( timeReg->ACK ) - printl( "SysCom ack received ID %d !!! 0x%x\n", timeReg->ACK, i ); - printl( "New Time COde Format = 0x%x\n", *dramRead ); + RTSLOG_INFO( "SysCom ack received ID %d !!! 0x%x\n", timeReg->ACK, i ); + RTSLOG_INFO( "New Time COde Format = 0x%x\n", *dramRead ); // End Wait **************************************** // // Set write and wait ***************************** @@ -118,14 +118,14 @@ symmetricomGpsInit( CDS_HARDWARE* pHardware, struct pci_dev* gpsdev ) i++; } while ( ( timeReg->ACK == 0 ) && ( i < 20 ) ); if ( timeReg->ACK ) - printl( "SysCom ack received ID %d !!! 0x%x\n", timeReg->ACK, i ); - printl( "New TC Modulation = 0x%x\n", *dramRead ); + RTSLOG_INFO( "SysCom ack received ID %d !!! 0x%x\n", timeReg->ACK, i ); + RTSLOG_INFO( "New TC Modulation = 0x%x\n", *dramRead ); // End Wait **************************************** for ( i = 0; i < 10; i++ ) { pHardware->gps[ 0 ] = 1; - printl( "Current time %ds %dus %dns \n", + RTSLOG_INFO( "Current time %ds %dus %dns \n", ( pHardware->gps[ 0x34 / 4 ] - 252806386 ), 0xfffff & pHardware->gps[ 0x30 / 4 ], 100 * ( ( pHardware->gps[ 0x30 / 4 ] >> 20 ) & 0xf ) ); @@ -133,9 +133,9 @@ symmetricomGpsInit( CDS_HARDWARE* pHardware, struct pci_dev* gpsdev ) pHardware->gps[ 0 ] = 1; time0 = pHardware->gps[ 0x30 / 4 ]; if ( time0 & ( 1 << 24 ) ) - printl( "Flywheeling, unlocked...\n" ); + RTSLOG_INFO( "Flywheeling, unlocked...\n" ); else - printl( "Locked!\n" ); + RTSLOG_INFO( "Locked!\n" ); return ( 0 ); } diff --git a/src/include/drv/vmic5565.c b/src/include/drv/vmic5565.c index 3d0008cf86795edbe6d21c35c39b6a75f68a8f85..237ec150c08f7fee5c9d9cc021679b8fa2e6e89c 100644 --- a/src/include/drv/vmic5565.c +++ b/src/include/drv/vmic5565.c @@ -13,7 +13,8 @@ #include "drv/cdsHardware.h" #include "commData3.h" // IPC_BUFFER_SIZE #include "map.h" //rfm_dma_handle -#include "util/printl.h" +#include "drv/rts-logger.h" + #include <linux/pci.h> @@ -50,11 +51,11 @@ vmic5565Init( CDS_HARDWARE* pHardware, struct pci_dev* rfmdev ) // Allocate local memory for IPC DMA xfers from RFM module pHardware->pci_rfm_dma[ devNum ] = (long)pci_alloc_consistent( rfmdev, IPC_BUFFER_SIZE, &rfm_dma_handle[ devNum ] ); - printl( "RFM address is 0x%ux\n", pci_io_addr ); + RTSLOG_INFO( "RFM address is 0x%ux\n", pci_io_addr ); // Find the RFM control/status register pci_read_config_dword( rfmdev, PCI_BASE_ADDRESS_2, &csrAddress ); - printl( "CSR address is 0x%x\n", csrAddress ); + RTSLOG_INFO( "CSR address is 0x%x\n", csrAddress ); csrAddr = IOREMAP( (unsigned long)csrAddress, 0x40 ); p5565Csr[ devNum ] = (VMIC5565_CSR*)csrAddr; @@ -62,39 +63,39 @@ vmic5565Init( CDS_HARDWARE* pHardware, struct pci_dev* rfmdev ) p5565Csr[ devNum ]->LCSR1 &= ~TURN_OFF_5565_FAIL; p5565Csr[ devNum ]->LCSR1 &= !1; // Turn off own data light - printl( "Board id = 0x%x\n", p5565Csr[ devNum ]->BID ); + RTSLOG_INFO( "Board id = 0x%x\n", p5565Csr[ devNum ]->BID ); pHardware->rfmConfig[ devNum ] = p5565Csr[ devNum ]->NID; // Check switches and such if ( p5565Csr[ devNum ]->LCSR1 & VMIC_5565_REDUNDANT_MODE ) - printl( "VMIC5565 set to redundant transfers\n" ); + RTSLOG_INFO( "VMIC5565 set to redundant transfers\n" ); else - printl( "VMIC5565 set to single transfers\n" ); + RTSLOG_INFO( "VMIC5565 set to single transfers\n" ); if ( p5565Csr[ devNum ]->LCSR1 & VMIC_5565_ROGUE_MASTER1 ) - printl( "VMIC5565 ROGUE MASTER 1 = ON\n" ); + RTSLOG_INFO( "VMIC5565 ROGUE MASTER 1 = ON\n" ); else - printl( "VMIC5565 ROGUE MASTER 1 = OFF\n" ); + RTSLOG_INFO( "VMIC5565 ROGUE MASTER 1 = OFF\n" ); if ( p5565Csr[ devNum ]->LCSR1 & VMIC_5565_ROGUE_MASTER0 ) - printl( "VMIC5565 ROGUE MASTER 0 = ON\n" ); + RTSLOG_INFO( "VMIC5565 ROGUE MASTER 0 = ON\n" ); else - printl( "VMIC5565 ROGUE MASTER 0 = OFF\n" ); + RTSLOG_INFO( "VMIC5565 ROGUE MASTER 0 = OFF\n" ); if ( p5565Csr[ devNum ]->LCSR1 & VMIC_5565_MEM_SIZE ) - printl( "VMIC5565 Memory size = 128MBytes\n" ); + RTSLOG_INFO( "VMIC5565 Memory size = 128MBytes\n" ); else - printl( "VMIC5565 Memory size = 64MBytes\n" ); + RTSLOG_INFO( "VMIC5565 Memory size = 64MBytes\n" ); // // Find DMA Engine controls in RFM Local Configuration Table pci_read_config_dword( rfmdev, PCI_BASE_ADDRESS_0, &dmaAddress ); - printl( "DMA address is 0x%ux\n", dmaAddress ); + RTSLOG_INFO( "DMA address is 0x%ux\n", dmaAddress ); dmaAddr = IOREMAP( dmaAddress, 0x200 ); p5565Dma[ devNum ] = (VMIC5565DMA*)dmaAddr; // pHardware->rfm_dma[devNum] = p5565Dma[devNum]; - printl( "5565DMA at 0x%lx\n", (unsigned long int)p5565Dma[ devNum ] ); - printl( "5565 INTCR = 0x%ux\n", p5565Dma[ devNum ]->INTCSR ); + RTSLOG_INFO( "5565DMA at 0x%lx\n", (unsigned long int)p5565Dma[ devNum ] ); + RTSLOG_INFO( "5565 INTCR = 0x%ux\n", p5565Dma[ devNum ]->INTCSR ); p5565Dma[ devNum ]->INTCSR = 0; // Disable interrupts from this card - printl( "5565 INTCR = 0x%ux\n", p5565Dma[ devNum ]->INTCSR ); - printl( "5565 MODE = 0x%ux\n", p5565Dma[ devNum ]->DMA0_MODE ); - printl( "5565 DESC = 0x%ux\n", p5565Dma[ devNum ]->DMA0_DESC ); + RTSLOG_INFO( "5565 INTCR = 0x%ux\n", p5565Dma[ devNum ]->INTCSR ); + RTSLOG_INFO( "5565 MODE = 0x%ux\n", p5565Dma[ devNum ]->DMA0_MODE ); + RTSLOG_INFO( "5565 DESC = 0x%ux\n", p5565Dma[ devNum ]->DMA0_DESC ); // Preload some DMA settings // Only important items here are BTC and DESC fields, which are used // later by DMA routine. diff --git a/src/include/fm10Gen.h b/src/include/fm10Gen.h index 34bf6bd3108be2e5de8cdfdb32215ebee3296543..dfde04a835cec745edbf3198fe3288ebdfd6fb8f 100644 --- a/src/include/fm10Gen.h +++ b/src/include/fm10Gen.h @@ -243,7 +243,7 @@ readCoefVme( for ( ii = bF; ii < sF; ii++ ) { filtC->coeffs[ ii ].biquad = pRfmCoeff->vmeCoeffs[ ii ].biquad; - // if(filtC->coeffs[ii].biquad) printl("Found a BQF filter %d\n",ii); + // if(filtC->coeffs[ii].biquad) RTSLOG_INFO("Found a BQF filter %d\n",ii); for ( jj = 0; jj < FILTERS; jj++ ) { if ( pRfmCoeff->vmeCoeffs[ ii ].filtSections[ jj ] ) @@ -255,7 +255,7 @@ readCoefVme( filtC->coeffs[ ii ].filterType[ jj ] > MAX_FIR_MODULES ) { filtC->coeffs[ ii ].filterType[ jj ] = 0; - // printl("Corrupted data coming from Epics: module=%d + // RTSLOG_ERROR("Corrupted data coming from Epics: module=%d // filter=%d filterType=%d\n", // ii, jj, pRfmCoeff->vmeCoeffs[ii].filterType[jj]); return 1; @@ -274,7 +274,7 @@ readCoefVme( { if ( filtC->coeffs[ ii ].filtSections[ jj ] > 10 ) { - // printl("Corrupted Epics data: module=%d filter=%d + // RTSLOG_ERROR("Corrupted Epics data: module=%d filter=%d // filterType=%d filtSections=%d\n", ii, jj, // pRfmCoeff->vmeCoeffs[ii].filterType[jj], // filtC->coeffs[ii].filtSections[jj]); diff --git a/src/include/util/formatting.h b/src/include/util/formatting.h new file mode 100644 index 0000000000000000000000000000000000000000..12ef2985bf7eeecf752abe66bd47c1a1f0f434e9 --- /dev/null +++ b/src/include/util/formatting.h @@ -0,0 +1,26 @@ +#ifndef LIGO_FORMATTING_H_INCLUDED +#define LIGO_FORMATTING_H_INCLUDED + +/** + * This headers defines the following functions for + * kernel or userspace. + * + * sprintf + * snprintf + * vsnprintf + * + * sscanf + * + * + */ + +#ifdef __KERNEL__ +#include <linux/kernel.h> //snprintf, etc +#else //__KERNEL__ + +#include <stdio.h> +#endif //!__KERNEL__ + + + +#endif diff --git a/test/run b/test/run index 1759c8222d38c45cc1be32d788ab8cfdf532892a..bc7b5d9a83bb7e6d5175271d3fd2019ba37b7b18 100755 --- a/test/run +++ b/test/run @@ -57,11 +57,11 @@ case $1 in $BIN/rts_epics_exec x1iopvirt & sleep 5 - $RCG_BUILDD/src/fe/x1iopvirt_usp/x1iopvirt & #& caput X1:FEC-17_BURT_RESTORE 1 + $RCG_BUILDD/models/x1iopvirt/target/bin/x1iopvirt & #& caput X1:FEC-17_BURT_RESTORE 1 sleep 10 $BIN/rts_epics_exec x1tst & sleep 5 - $RCG_BUILDD/src/fe/x1tst_usp/x1tst & + $RCG_BUILDD/models/x1tst/target/bin/x1tst & sleep 10 pkill -9 x1tst sleep 1 diff --git a/test/x1iop.mdl b/test/x1iop.mdl index 07bf0a3ee57062dc32fac64dd92b12e0a6618c21..20679a254bea39d2ce20b766c69c0d9c756d5c43 100644 --- a/test/x1iop.mdl +++ b/test/x1iop.mdl @@ -223,7 +223,7 @@ Model { } ExternalFileReference { Reference "cdsParameters/Subsystem" - Path "x1iop/host=@HOSTNAME@ ifo=X1 rate=64K dcuid=1 shmem_daq=1 iop_model=1 specific_cpu=2" + Path "x1iop/host=@HOSTNAME@ ifo=X1 rate=64K dcuid=17 iop_model=1 specific_cpu=2" SID "927" Type "LIBRARY_BLOCK" } @@ -2716,7 +2716,7 @@ Model { } Block { BlockType Reference - Name "host=@HOSTNAME@\nifo=X1\nrate=64K\ndcuid=10\nshmem_daq=1\niop_model=1\nspecific_cpu=2" + Name "host=@HOSTNAME@\nifo=X1\nrate=64K\ndcuid=17\niop_model=1\nspecific_cpu=2" SID "927" Tag "cdsParameters" Ports [1, 1] diff --git a/test/x1iopvirt.mdl b/test/x1iopvirt.mdl index 927199cb1fa3cec805cdbb2e5d08ec2d20d18dde..4d57e10b68f4944b81bbeb69436abf185e894943 100644 --- a/test/x1iopvirt.mdl +++ b/test/x1iopvirt.mdl @@ -223,7 +223,7 @@ Model { } ExternalFileReference { Reference "cdsParameters/Subsystem" - Path "x1iop/host=@HOSTNAME@ ifo=X1 rate=64K dcuid=1 shmem_daq=1 iop_model=1 specific_cpu=2" + Path "x1iop/host=@HOSTNAME@ ifo=X1 rate=64K dcuid=18 iop_model=1 specific_cpu=2" SID "927" Type "LIBRARY_BLOCK" } @@ -2716,7 +2716,7 @@ Model { } Block { BlockType Reference - Name "host=@HOSTNAME@\nifo=X1\nrate=64K\ndcuid=17\nshmem_daq=1\niop_model=1\nspecific_cpu=2\nvirtualIOP=1\nrequireIOcnt=0\nno_daq=1" + Name "host=@HOSTNAME@\nifo=X1\nrate=64K\ndcuid=18\niop_model=1\nspecific_cpu=2\nvirtualIOP=1\nrequireIOcnt=0\nno_daq=1" SID "927" Tag "cdsParameters" Ports [1, 1] diff --git a/test/x1tst.mdl b/test/x1tst.mdl index 7e053b39cb4abf46449be0f372971302adb5e23a..ce7b7e093389b47eed4d363b5c5c0963fabc1a1d 100644 --- a/test/x1tst.mdl +++ b/test/x1tst.mdl @@ -519,8 +519,7 @@ Model { } ExternalFileReference { Reference "cdsParameters/Subsystem" - Path "x1tst/host=@HOSTNAME@ ifo=X1 rate=2K dcuid=11 shmem_daq=1 adcSlave=1 specific_cpu=3 no_cpu_shutdown" - "=1 requireIOcnt=0" + Path "x1tst/host=@HOSTNAME@ ifo=X1 rate=2K dcuid=19 specific_cpu=3 requireIOcnt=0" SID "927" Type "LIBRARY_BLOCK" } @@ -6956,8 +6955,7 @@ Model { } Block { BlockType Reference - Name "host=@HOSTNAME@\nifo=X1\nrate=2K\ndcuid=11\nshmem_daq=1\nadcSlave=1\nspecific_cpu=3\nno_cpu_shutdow" - "n=1\nrequireIOcnt=0" + Name "host=@HOSTNAME@\nifo=X1\nrate=2K\ndcuid=19\nspecific_cpu=3\nrequireIOcnt=0" SID "927" Tag "cdsParameters" Ports []