1 #ifndef GCP_ANTENNA_CONTROL_TFP_H
2 #define GCP_ANTENNA_CONTROL_TFP_H
11 #include <sys/types.h>
21 #include "gcp/util/common/RegDate.h"
22 #include "gcp/util/common/TimeVal.h"
40 CTL_OFF_TIMEREQ = 0x0,
45 CTL_OFF_EVENTREQ = 0x4,
57 CTL_OFF_RESERVED1 = 0xC,
61 CTL_OFF_CONTROL = 0x10,
77 CTL_OFF_INTSTAT = 0x1C,
89 CTL_OFF_MINSTRB = 0x20,
90 CTL_OFF_MAJSTRB = 0x24,
94 CTL_OFF_RESERVED2 = 0x28,
95 CTL_OFF_RESERVED3 = 0x2C,
101 CTL_OFF_TIME0 = 0x30,
102 CTL_OFF_TIME1 = 0x34,
109 CTL_OFF_EVENT0 = 0x38,
110 CTL_OFF_EVENT1 = 0x3C
149 CTL_EVSOURCE_BIT = 1,
153 CTL_RESERVED_BIT = 2,
178 CTL_FREQSEL0_BIT = 6,
179 CTL_FREQSEL1_BIT = 7,
216 MASK_PERIODIC_BIT = 1,
227 DP_CMD_TIME_MODE = 0x10,
228 DP_CMD_TIME_FORMAT = 0x11,
229 DP_CMD_SET_MAJOR = 0x12,
230 DP_CMD_SET_YEAR = 0x13,
231 DP_CMD_SET_PERIODIC_OUTPUT = 0x14,
232 DP_CMD_SET_INP_FORMAT = 0x15,
233 DP_CMD_SET_INP_MOD = 0x16,
234 DP_CMD_SET_PROP_DELAY = 0x17,
235 DP_CMD_REQ_DATA = 0x19,
236 DP_CMD_SOFT_RESET = 0x1A,
237 DP_CMD_SET_OUT_FORMAT = 0x1B,
238 DP_CMD_GEN_OFFSET = 0x1C,
239 DP_CMD_LCL_OFFSET = 0x1D,
240 DP_CMD_SET_CLK_SRC = 0x20,
241 DP_CMD_GPS_FMT = 0x33,
242 DP_CMD_SET_GPS_MODE_FLAG = 0x34,
243 DP_CMD_YEAR_AUTO_INC = 0x42,
244 DP_CMD_REQ_ASSY = 0xf4,
245 DP_CMD_REQ_MODEL = 0xf6
258 enum TimeCodeFormat {
262 FORMAT_NASA36 = 0x4E,
265 enum InputTimeCodeModType {
282 MODE_TIMECODE = 0x00,
285 MODE_REAL_CLOCK = 0x03,
296 ALL = INT_EVENT | INT_PERIODIC | INT_TIME | INT_1PPS | INT_GPS
301 static const std::string devName_;
308 static const unsigned ctlSizeInBytes_ = 0x1000;
314 static const unsigned ctlOffsetInBytes_ = 0x0;
321 static const unsigned dpramSizeInBytes_ = 0x1000;
326 static const unsigned dpramOffsetInBytes_ = 0x1000;
331 Tfp(
bool simulate=
false);
343 void setYear(
unsigned short year);
345 void setMajorTime(
unsigned short year,
unsigned short dayNo,
346 unsigned char hours,
unsigned char minutes,
347 unsigned char seconds);
349 void setTimeMode(TimeMode mode);
355 void setPeriodicOutput(
bool syncToPps,
unsigned short n1,
unsigned short n2);
362 void setGeneratorTimeOffset(
short offset,
bool halfHour=
false);
363 void setLocalTimeOffset(
short offset,
bool halfHour=
false);
364 void setPropagationDelay(
int delayIn100ns);
365 void setClockSource(ClockSource src);
366 void setGpsFormat(GpsFormat format);
367 void enableGpsModeFlag(
bool enable);
368 void enableYearAutoIncrement(
bool enable);
371 void specificSetUp();
375 static void testBits(
unsigned int iVal);
376 static void printBits(
unsigned char c);
377 static void printBits(
unsigned short s);
378 static void printBits(
unsigned int i);
379 static unsigned short constructShort(
unsigned char msb,
unsigned char lsb);
380 static unsigned constructInt(
unsigned char msb,
unsigned char smsb,
381 unsigned tmsb,
unsigned char lsb);
393 DpramCmd(DpramCmdId cmd);
394 void packVal(
unsigned char val);
395 void packVal(
unsigned short val);
396 void packVal(
unsigned int val);
398 std::vector<unsigned char> data_;
406 unsigned dpramPtrLength_;
409 unsigned short dpramInOffset_;
412 unsigned short dpramOutOffset_;
415 unsigned short dpramGpsOffset_;
418 unsigned short dpramYearOffset_;
422 unsigned char* dpramInPtr_;
423 unsigned char* dpramOutPtr_;
424 unsigned char* dpramGpsPtr_;
425 unsigned char* dpramYearPtr_;
430 unsigned ctlPtrLength_;
434 unsigned* ctlAckPtr_;
435 unsigned* ctlCtlPtr_;
436 unsigned* ctlTime0Ptr_;
437 unsigned* ctlTime1Ptr_;
438 unsigned* ctlTimeReqPtr_;
441 void resetCtlPointers();
442 void resetDpramPointers();
444 void mapCtlPtr(
unsigned byteOffset=0);
445 void mapDpramPtr(
unsigned byteOffset=0);
448 unsigned char* ctlPtr();
449 unsigned char* dpramPtr();
450 void sendDpramCmd(DpramCmd& cmd,
bool wait=
true);
452 void setBit(
unsigned& mask,
unsigned short bit,
bool enable);
462 #endif // End #ifndef GCP_ANTENNA_CONTROL_TFP_H
void requestAssemblyPartNo()
Definition: Tfp.cc:529
static unsigned short constructShort(unsigned char msb, unsigned char lsb)
Definition: Tfp.cc:669
void close()
Definition: Tfp.cc:99
void enableInterrupt(unsigned mask, bool enable)
Definition: Tfp.cc:780
void readUnixTime(gcp::util::TimeVal &tVal)
Definition: Tfp.cc:383
void setInputTimeCodeFormat(TimeCodeFormat format)
Definition: Tfp.cc:444
void requestModelId()
Definition: Tfp.cc:552
void setInputTimeCodeModType(InputTimeCodeModType mod)
Definition: Tfp.cc:464
void softReset()
Definition: Tfp.cc:504
unsigned short readYear()
Definition: Tfp.cc:513
void open()
Definition: Tfp.cc:82
void setMajorTime(unsigned int seconds)
Definition: Tfp.cc:474
static unsigned constructInt(unsigned char msb, unsigned char smsb, unsigned tmsb, unsigned char lsb)
Definition: Tfp.cc:684
Tfp(bool simulate=false)
Definition: Tfp.cc:24
void setTimeFormat(TimeFormat format)
Definition: Tfp.cc:434
virtual ~Tfp()
Definition: Tfp.cc:37
void setOutputTimeCodeFormat(TimeCodeFormat format)
Definition: Tfp.cc:454
void readBcdTime(gcp::util::TimeVal &tVal)
Definition: Tfp.cc:354
void setYear(unsigned short year)
Definition: Tfp.cc:414
void setOutputClockFreq(OutputFreq freq)
Definition: Tfp.cc:605
void setFrequencyOutput(bool syncToPps, double dutyCyclePerc, double freqInHz)
Definition: Tfp.cc:581