2023-04-11 11:13:23 -04:00
|
|
|
#ifndef MACRO_H
|
|
|
|
#define MACRO_H
|
|
|
|
|
2023-08-14 11:44:58 -04:00
|
|
|
#define MaxNPorts 4 //for optical link
|
2024-03-19 16:13:44 -04:00
|
|
|
#define MaxNBoards 4 //for both optical link and usb
|
2023-04-24 17:37:03 -04:00
|
|
|
|
|
|
|
#define MaxNDigitizer MaxNPorts * MaxNBoards
|
|
|
|
|
2023-10-06 16:50:28 -04:00
|
|
|
#define MaxRegChannel 16
|
|
|
|
#define MaxNChannels 64
|
2023-04-11 11:13:23 -04:00
|
|
|
#define MaxRecordLength 0x3fff * 8
|
|
|
|
#define MaxSaveFileSize 1024 * 1024 * 1024 * 2
|
|
|
|
|
2024-04-09 13:54:44 -04:00
|
|
|
#define MaxDisplayTraceTimeLength 20000 //ns
|
2023-08-24 13:27:16 -04:00
|
|
|
#define ScopeUpdateMiliSec 200 // msec
|
2023-10-11 18:28:19 -04:00
|
|
|
#define MaxNumberOfTrace 5 // in an event
|
2023-04-18 13:12:05 -04:00
|
|
|
|
2023-04-11 11:13:23 -04:00
|
|
|
#define SETTINGSIZE 2048
|
|
|
|
|
2023-08-17 12:50:45 -04:00
|
|
|
#define DAQLockFile "DAQLock.dat"
|
|
|
|
#define PIDFile "pid.dat"
|
|
|
|
|
2023-04-11 11:13:23 -04:00
|
|
|
#include <sys/time.h> /** struct timeval, select() */
|
|
|
|
|
2024-01-25 16:18:47 -05:00
|
|
|
inline unsigned int getTime_us(){
|
2023-04-11 11:13:23 -04:00
|
|
|
unsigned int time_us;
|
|
|
|
struct timeval t1;
|
|
|
|
struct timezone tz;
|
|
|
|
gettimeofday(&t1, &tz);
|
|
|
|
time_us = (t1.tv_sec) * 1000 * 1000 + t1.tv_usec;
|
|
|
|
return time_us;
|
|
|
|
}
|
|
|
|
|
2024-01-19 03:07:55 -05:00
|
|
|
#include <chrono>
|
|
|
|
inline unsigned long long getTime_ns(){
|
|
|
|
std::chrono::high_resolution_clock::time_point currentTime = std::chrono::high_resolution_clock::now();
|
|
|
|
std::chrono::nanoseconds nanoseconds = std::chrono::duration_cast<std::chrono::nanoseconds>(currentTime.time_since_epoch());
|
|
|
|
return nanoseconds.count();
|
|
|
|
}
|
|
|
|
|
2024-01-18 18:55:37 -05:00
|
|
|
typedef unsigned short uShort;
|
|
|
|
typedef unsigned int uInt;
|
|
|
|
typedef unsigned long uLong;
|
|
|
|
typedef unsigned long long ullong;
|
|
|
|
|
2024-03-22 16:47:33 -04:00
|
|
|
#define DebugMode 0 //process check, when 1, print out all function call
|
|
|
|
|
|
|
|
// if DebugMode is 1, define DebugPrint() to be printf(), else, DebugPrint() define nothing
|
|
|
|
#if DebugMode
|
|
|
|
#define DebugPrint(fmt, ...) printf(fmt "::%s\n",##__VA_ARGS__, __func__);
|
|
|
|
#else
|
|
|
|
#define DebugPrint(fmt, ...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2023-04-11 11:13:23 -04:00
|
|
|
#endif
|