Arianna autonomous DAQ firmware
Dependencies: mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW
Diff: SnConstants.h
- Revision:
- 84:80b15993944e
- Parent:
- 83:a0d38ba9d6c2
- Child:
- 86:051a09841ca3
--- a/SnConstants.h Mon Feb 23 03:04:39 2015 +0000 +++ b/SnConstants.h Fri Oct 30 04:49:40 2015 +0000 @@ -1,18 +1,9 @@ #ifndef SN_SnConstants #define SN_SnConstants -// available CHIPBOARDs -- these values should never change! -#define ATWD4CH 0 // set CHIPBOARD to this to get firmware for the 2012-2013 stations (value is arbitrary but unique) -#define SST4CH 1 // set CHIPBOARD to this to get firmware for the 2014 stations with a single SST chip (value is arbitrary but unique) - -// which chip/board combination to build this firmware for -//#define CHIPBOARD ATWD4CH -#define CHIPBOARD SST4CH - -//#define DEBUG - -//#define USE_INTERFACE_CHIP - +// see this file for various switches and options +// used to buid the mbed binary +#include "SnPreCompOptions.h" #include "SnBitUtils.h" #include "SnCommConstants.h" @@ -22,7 +13,7 @@ // // this should be updated for each and every mbed board (ugh!) -//static const char kDefaultMacAdress[] = {0x00, 0x02, 0xAA, 0xAA, 0xAA, 0xAA}; // for testing SST +static const char kDefaultMacAdress[] = {0x00, 0x02, 0xAA, 0xAA, 0xAA, 0xAA}; // for testing SST //static const char kDefaultMacAdress[] = {0x00, 0x02, 0xBB, 0xBB, 0xBB, 0xBB}; // for testing ATWD //static const char kDefaultMacAdress[] = {0x00, 0x02, 0xF7, 0xF0, 0xAE, 0xE0}; // STN 20 (ATWD MB 1) 0002F7F0AEE0 //static const char kDefaultMacAdress[] = {0x00, 0x02, 0xF7, 0xF0, 0xC3, 0xB6}; // STN 3 (ATWD MB 5) 0002F7F0C3B6 @@ -30,7 +21,7 @@ //static const char kDefaultMacAdress[] = {0x00, 0x02, 0xF7, 0xF0, 0xC6, 0x1A}; // STN 10 (ATWD MB 8) 0002F7F0C61A //static const char kDefaultMacAdress[] = {0x00, 0x02, 0xF7, 0xF2, 0x0A, 0x9C}; // STN 14 (SST 104) 0002F7F20A9C //static const char kDefaultMacAdress[] = {0x00, 0x02, 0xF7, 0xF2, 0x02, 0xC1}; // STN 17 (SST 109) 0002F7F202C1 - static const char kDefaultMacAdress[] = {0x00, 0x02, 0xF7, 0xF2, 0x24, 0x44}; // STN 19 (SST 105) 0002F7F22444 +//static const char kDefaultMacAdress[] = {0x00, 0x02, 0xF7, 0xF2, 0x24, 0x44}; // STN 19 (SST 105) 0002F7F22444 //static const char kDefaultMacAdress[] = {0x00, 0x02, 0xF7, 0xF1, 0xF7, 0xA8}; // STN 15 (SST 110) 0002F7F1F7A8 // if these change, it is likely that some i/o version (config, event, etc) will need to change @@ -70,16 +61,18 @@ static const uint8_t kUpdateDacCmd = 0x3u; // LTC2657 DAC chip command bits that write to & update DAC value static const uint8_t kMaxDacSetTries = 3u; // how many times to retry setting a dac in case no ACK is received from the DAC chip #endif -static const uint8_t kNcomms = 2u; -static const uint16_t kNvoltsAve = 500u; // must be greater than ~10 (but not checked. <2 will result in divide by 0) +static const uint8_t kNcomms = 2u; // must match the number of comms enabled in SnPreCompOptions +static const uint16_t kNvoltsAve = 500u; // must be greater than ~10 (but not checked. <2 will result in a divide by 0) static const uint32_t kAbsMaxTimer = 1800u; // timers use integers counting us and can't go longer than ~ this many secs // NOTE: these times (in sec) must be less than kAbsMaxTimer (this is not checked, however) -static const uint8_t kDefTimeoutMin = 3u; // minutes. used in case a clock error is detected or range needs enforcing +static const uint8_t kDefTimeoutMin = 1u; // minutes. used in case (minimum) range needs enforcing +static const uint8_t kDefTimeoutSafe = 3u; // minutes. used in case a clock error is detected or max range needs enforcing static const uint32_t kCommWinLongPrdTk = 300u; // seconds. check if it's time for a comm win every X sec. this way comm per can be longer than Timer allows -static const uint16_t kMaxConsecCommFails = 4; // (exclusive) number of times a comm win can fail before the mbed resets +// 2015-10-12: increased from 4 to 75. this raises the window before a reboot from ~1 hour to ~1 day, depending on config options +static const uint16_t kMaxConsecCommFails = 75; // (exclusive) number of times a comm win can fail before the mbed resets // safety nets static const uint16_t kMaxFirstSeq = 25000; // max specifiable seq number -- leave room to grow @@ -96,17 +89,35 @@ static const uint16_t kTotDacs = kNchans*kNchanDacs; -enum ESnTrgTypes { - kThmTrg=0, - kFrcTrg=1, - kExtTrg=2, - kAdcToMBflag=3, +enum ETrgBit_t { + kThermal = BIT(0), // thermal trigger + kForced = BIT(1), // forced trigger + kExternal = BIT(2), // reserved for external, but impossible to set with current DAQ + kSingleFreqSupp = BIT(3), // the L1 trigger to cut away events with a large fraction of power in a single frequency + // bits 4,5 not yet used + kL1TrgApplied = BIT(6), // whether to throw away events based on L1 triggers + kAdcToMBflag = BIT(7) // flag events that took too long to get data from dCards to MB +}; + +/* + kThmTrg= + kFrcTrg=1, // BIT 1 + kExtTrg=2, // BIT 2 + kAdcToMBflag=3, // BIT 7 **note order** (not BIT(3)) + // L1 triggers + kSingleFreqSupp=4, // BIT 3 **note order** (not BIT(4)) + k kNumTrgs }; // order must match ESnTrgTypes -static const uint8_t kTrgBW[kNumTrgs] = { BIT(0), BIT(1), BIT(2), BIT(7) }; +static const uint8_t kTrgBW[kNumTrgs] = { BIT(0), BIT(1), BIT(2), BIT(7), BIT(3) }; +*/ - +enum EL1TrigStatus { + kL1Fail=0, + kL1Pass=1, + kL1UnableToProcess=2 +}; #endif // SN_SnConstants \ No newline at end of file