Skip to content
Snippets Groups Projects
Commit 89e67f09 authored by Jonathan Hanks's avatar Jonathan Hanks
Browse files

Removed commented out code and the logfile from standalone_edcu.

parent 5632a8db
No related branches found
No related tags found
No related merge requests found
...@@ -40,9 +40,6 @@ extern "C" { ...@@ -40,9 +40,6 @@ extern "C" {
#include <iostream> #include <iostream>
#define EDCU_MAX_CHANS 50000 #define EDCU_MAX_CHANS 50000
// Gloabl variables
// ****************************************************************************************
char naughtyList[ EDCU_MAX_CHANS ][ 64 ];
// Function prototypes // Function prototypes
// **************************************************************************************** // ****************************************************************************************
...@@ -76,17 +73,15 @@ static const int buf_size = DAQ_DCU_BLOCK_SIZE * 2; ...@@ -76,17 +73,15 @@ static const int buf_size = DAQ_DCU_BLOCK_SIZE * 2;
static const int header_size = static const int header_size =
sizeof( struct rmIpcStr ) + sizeof( struct cdsDaqNetGdsTpNum ); sizeof( struct rmIpcStr ) + sizeof( struct cdsDaqNetGdsTpNum );
static DAQ_XFER_INFO xferInfo; static DAQ_XFER_INFO xferInfo;
static float dataBuffer[ 2 ][ EDCU_MAX_CHANS ];
static int timeIndex; static int symmetricom_fd = -1;
static int cycleIndex; int timemarks[ 16 ] = { 1000 * 1000, 63500 * 1000, 126000 * 1000,
static int symmetricom_fd = -1;
int timemarks[ 16 ] = { 1000 * 1000, 63500 * 1000, 126000 * 1000,
188500 * 1000, 251000 * 1000, 313500 * 1000, 188500 * 1000, 251000 * 1000, 313500 * 1000,
376000 * 1000, 438500 * 1000, 501000 * 1000, 376000 * 1000, 438500 * 1000, 501000 * 1000,
563500 * 1000, 626000 * 1000, 688500 * 1000, 563500 * 1000, 626000 * 1000, 688500 * 1000,
751000 * 1000, 813500 * 1000, 876000 * 1000, 751000 * 1000, 813500 * 1000, 876000 * 1000,
938500 * 1000 }; 938500 * 1000 };
int nextTrig = 0; int nextTrig = 0;
// End Header ************************************************************ // End Header ************************************************************
// //
...@@ -277,25 +272,6 @@ subscriptionHandler( struct event_handler_args args ) ...@@ -277,25 +272,6 @@ subscriptionHandler( struct event_handler_args args )
} }
} }
// **************************************************************************
int
edcuFindUnconnChannels( )
// **************************************************************************
{
int ii;
int dcc = 0;
for ( ii = 0; ii < daqd_edcu1.num_chans; ii++ )
{
if ( daqd_edcu1.channel_status[ ii ] != 0 )
{
sprintf( naughtyList[ dcc ], "%s", daqd_edcu1.channel_name[ ii ] );
dcc++;
}
}
return ( dcc );
}
/** /**
* Scan the input text for the first non-whitespace character and return a * Scan the input text for the first non-whitespace character and return a
* pointer to that location. * pointer to that location.
...@@ -541,15 +517,12 @@ veto_line_due_to_datatype( const char* line ) ...@@ -541,15 +517,12 @@ veto_line_due_to_datatype( const char* line )
// ************************************************************************** // **************************************************************************
void void
edcuCreateChanList( const char* pref, edcuCreateChanList( const char* pref, const char* daqfilename )
const char* daqfilename,
const char* edculogfilename )
{ {
// ************************************************************************** // **************************************************************************
int i; int i;
int status; int status;
FILE* daqfileptr; FILE* daqfileptr;
FILE* edculog;
char errMsg[ 64 ]; char errMsg[ 64 ];
// char daqfile[64]; // char daqfile[64];
char line[ 128 ]; char line[ 128 ];
...@@ -570,16 +543,8 @@ edcuCreateChanList( const char* pref, ...@@ -570,16 +543,8 @@ edcuCreateChanList( const char* pref,
fprintf( fprintf(
stderr, "DAQ FILE ERROR: FILE %s DOES NOT EXIST\n", daqfilename ); stderr, "DAQ FILE ERROR: FILE %s DOES NOT EXIST\n", daqfilename );
} }
edculog = fopen( edculogfilename, "w" );
if ( daqfileptr == NULL )
{
fprintf( stderr,
"DAQ FILE ERROR: FILE %s DOES NOT EXIST\n",
edculogfilename );
}
while ( fgets( line, sizeof line, daqfileptr ) != NULL ) while ( fgets( line, sizeof line, daqfileptr ) != NULL )
{ {
fprintf( edculog, "%s", line );
status = strlen( line ); status = strlen( line );
if ( strncmp( line, "[", 1 ) == 0 && status > 0 ) if ( strncmp( line, "[", 1 ) == 0 && status > 0 )
{ {
...@@ -619,7 +584,6 @@ edcuCreateChanList( const char* pref, ...@@ -619,7 +584,6 @@ edcuCreateChanList( const char* pref,
} }
} }
fclose( daqfileptr ); fclose( daqfileptr );
fclose( edculog );
xferInfo.crcLength = 4 * daqd_edcu1.num_chans; xferInfo.crcLength = 4 * daqd_edcu1.num_chans;
printf( "CRC data length = %d\n", xferInfo.crcLength ); printf( "CRC data length = %d\n", xferInfo.crcLength );
...@@ -683,8 +647,6 @@ edcuCreateChanList( const char* pref, ...@@ -683,8 +647,6 @@ edcuCreateChanList( const char* pref,
} }
daqd_edcu1.con_chans = daqd_edcu1.con_chans + internal_channel_count; daqd_edcu1.con_chans = daqd_edcu1.con_chans + internal_channel_count;
timeIndex = 0;
} }
// ************************************************************************** // **************************************************************************
...@@ -790,39 +752,12 @@ checkFileCrc( const char* fName ) ...@@ -790,39 +752,12 @@ checkFileCrc( const char* fName )
return ( -1 ); return ( -1 );
} }
/// Routine for logging messages to ioc.log file.
/// @param[in] message Ptr to string containing message to be logged.
// void
// logFileEntry( char* message )
//{
// FILE* log;
// char timestring[ 256 ];
// long status;
// dbAddr paddr;
//
// getSdfTime( timestring );
// log = fopen( logfilename, "a" );
// if ( log == NULL )
// {
// status = dbNameToAddr( reloadtimechannel, &paddr );
// status = dbPutField( &paddr, DBR_STRING, "ERR - NO LOG FILE FOUND", 1
// );
// }
// else
// {
// fprintf( log, "%s\n%s\n", timestring, message );
// fprintf( log, "***************************************************\n"
// ); fclose( log );
// }
//}
void void
usage( const char* prog ) usage( const char* prog )
{ {
std::cout << "Usage:\n\t" << prog << " <options>\n\n"; std::cout << "Usage:\n\t" << prog << " <options>\n\n";
std::cout std::cout
<< "-b <mbuf name> - The name of the mbuf to write to [edc_daq]\n"; << "-b <mbuf name> - The name of the mbuf to write to [edc_daq]\n";
std::cout << "-l <log dir> - Directory to output logs to [logs]\n";
std::cout << "-d <dcu id> - The dcu id number to use [52]\n"; std::cout << "-d <dcu id> - The dcu id number to use [52]\n";
std::cout << "-i <ini file name> - The ini file to read [edc.ini]\n"; std::cout << "-i <ini file name> - The ini file to read [edc.ini]\n";
std::cout << "-w <wait time in ms> - Number of ms to wait after each 16Hz " std::cout << "-w <wait time in ms> - Number of ms to wait after each 16Hz "
...@@ -876,7 +811,6 @@ main( int argc, char* argv[] ) ...@@ -876,7 +811,6 @@ main( int argc, char* argv[] )
const char* daqsharedmemname = "edc_daq"; const char* daqsharedmemname = "edc_daq";
// const char* syncsharedmemname = "-"; // const char* syncsharedmemname = "-";
const char* logdir = "logs";
const char* daqFile = "edc.ini"; const char* daqFile = "edc.ini";
const char* prefix = ""; const char* prefix = "";
int mydcuid = 52; int mydcuid = 52;
...@@ -886,19 +820,13 @@ main( int argc, char* argv[] ) ...@@ -886,19 +820,13 @@ main( int argc, char* argv[] )
int delay_multiplier = 0; int delay_multiplier = 0;
int cur_arg = 0; int cur_arg = 0;
while ( ( cur_arg = getopt( argc, argv, "b:l:d:i:w:p:h" ) ) != EOF ) while ( ( cur_arg = getopt( argc, argv, "b:d:i:w:p:h" ) ) != EOF )
{ {
switch ( cur_arg ) switch ( cur_arg )
{ {
case 'b': case 'b':
daqsharedmemname = optarg; daqsharedmemname = optarg;
break; break;
// case 't':
// syncsharedmemname = optarg;
// break;
case 'l':
logdir = optarg;
break;
case 'd': case 'd':
mydcuid = atoi( optarg ); mydcuid = atoi( optarg );
break; break;
...@@ -919,12 +847,7 @@ main( int argc, char* argv[] ) ...@@ -919,12 +847,7 @@ main( int argc, char* argv[] )
} }
} }
if ( stat( logdir, &st ) == -1 )
mkdir( logdir, 0777 );
printf( "My dcuid is %d\n", mydcuid ); printf( "My dcuid is %d\n", mydcuid );
sprintf( logfilename, "%s%s", logdir, "/ioc.log" );
printf( "LOG FILE = %s\n", logfilename );
sleep( 2 ); sleep( 2 );
// ********************************************** // **********************************************
// //
...@@ -932,12 +855,11 @@ main( int argc, char* argv[] ) ...@@ -932,12 +855,11 @@ main( int argc, char* argv[] )
// EDCU STUFF // EDCU STUFF
// ******************************************************************************************************** // ********************************************************************************************************
sprintf( edculogfilename, "%s%s", logdir, "/edcu.log" );
for ( ii = 0; ii < EDCU_MAX_CHANS; ii++ ) for ( ii = 0; ii < EDCU_MAX_CHANS; ii++ )
daqd_edcu1.channel_status[ ii ] = 0xbad; daqd_edcu1.channel_status[ ii ] = 0xbad;
edcuInitialize( daqsharedmemname, "-" ); edcuInitialize( daqsharedmemname, "-" );
// edcuCreateChanFile(daqDir,daqFile,pref); // edcuCreateChanFile(daqDir,daqFile,pref);
edcuCreateChanList( prefix, daqFile, edculogfilename ); edcuCreateChanList( prefix, daqFile );
int datarate = daqd_edcu1.num_chans * 64 / 1000; int datarate = daqd_edcu1.num_chans * 64 / 1000;
// Start SPECT // Start SPECT
...@@ -989,49 +911,6 @@ main( int argc, char* argv[] ) ...@@ -989,49 +911,6 @@ main( int argc, char* argv[] )
edcuWriteData( edcuWriteData(
daqd_edcu1.epicsSync, daqd_edcu1.gpsTime, mydcuid, send_daq_reset ); daqd_edcu1.epicsSync, daqd_edcu1.gpsTime, mydcuid, send_daq_reset );
send_daq_reset = 0;
// status = dbPutField( &gpstimedisplayaddr,
// DBR_LONG,
// &daqd_edcu1.gpsTime,
// 1 ); // Init to zero.
// status = dbPutField( &daqbyteaddr, DBR_LONG, &datarate, 1 );
int conChans = daqd_edcu1.con_chans;
// status = dbPutField( &eccaddr, DBR_LONG, &conChans, 1 );
// Check unconnected channels once per second
if ( daqd_edcu1.epicsSync == 0 )
{
// status = dbGetField(
// &daqresetaddr, DBR_LONG, &daqreset, &ropts,
// &nvals, NULL );
// if ( daqreset )
// {
// status = dbPutField(
// &daqresetaddr, DBR_LONG, &ropts, 1 ); // Init
// to zero.
// send_daq_reset = 1;
// }
numDC = edcuFindUnconnChannels( );
if ( numDC < ( pageNumDisp * 40 ) )
pageNumDisp--;
// numReport = edcuReportUnconnChannels( pref, numDC,
// pageNumDisp );
}
// status = dbPutField( &chnotfoundaddr, DBR_LONG, &numDC, 1 );
fivesectimer = ( fivesectimer + 1 ) %
50; // Increment 5 second timer for triggering CRC checks.
// Check file CRCs every 5 seconds.
// DAQ and COEFF file checking was moved from skeleton.st to here RCG
// V2.9.
/*if(!fivesectimer) {
status = checkFileCrc(daqFile);
if(status != daqFileCrc) {
daqFileCrc = status;
status =
dbPutField(&daqmsgaddr,DBR_STRING,modfilemsg,1); logFileEntry("Detected
Change to DAQ Config file.");
}
}*/
cycle = ( cycle + 1 ) % 16; cycle = ( cycle + 1 ) % 16;
transmit_time = transmit_time + time_step; transmit_time = transmit_time + time_step;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment