40 static uint32_t _chEnabled = 0;
42 static
void optReset()
50 for (i = 0; i < OPT_CH_COUNT; ++i)
64 for (i = 0; i < OPT_CH_COUNT; ++i)
69 int brd = _OCT_BRD(i);
87 static bool optConfig()
94 for (i = 0; i < OPT_CH_COUNT; ++i)
96 int brd = _OCT_BRD(i);
106 _chEnabled |=
BIT(i);
112 _chEnabled |=
BIT(i);
117 logError(
"Failed to initialize channel %d (brd=%s, ch=%d)",
118 i, brd == 0 ?
"small" :
"large", ch);
134 static bool optUnConfig()
140 for (i = 0; i < OPT_CH_COUNT; ++i)
144 int brd = _OCT_BRD(i);
159 bool _showErrOnce =
true;
163 uint32_t fault[2] = { 0xFFFFFFFF, 0xFFFFFFFF };
186 if (
errHas() && _showErrOnce) {
191 _showErrOnce =
false;
195 for (i = 0; i < OPT_CH_COUNT; ++i)
197 int brd = _OCT_BRD(i);
206 if ((fault[brd] & (1 << ch)) == 0)
218 bool _subsOptUpdate(
ClbState state, uint32_t time)
226 void _subsOptExecEvent (
ClbEvent event)
300 logWarn(
"Failed set LED voltage to 0 on power board");
bool errHas()
Returns whether there is an error pending.
This module implements the functionality required by the octopus board (large).
This module provides access to the peripherals on the power board.
bool nanoConfig(uint32_t delay, uint32_t period, uint32_t width, uint32_t noOfPulses)
Configures the nano-beacon.
bool octoHighVoltage(int brd, int ch, bool hvOn)
Turns the high-voltage on or off.
ClbEvent
All state change events.
void tdcReset()
Resets the TDC to defaults.
void tdcSetMultiHitEnabled(uint32_t channels)
Sets on which channels the mutli-hit veto must be enabled.
uint16_t nano_pcount
Nano-beacon pulse train count, each second.
uint32_t chan_enable
Channel enable, bit per channel.
uint32_t hr_veto_ena_ch
High-rate veto enable, bit per channel.
Provides access to all variables of the various subsystems.
#define BIT(N)
Makes a value with the specified bit set.
#define OPT_STS_ERR_OVERCUR
Over current.
#define SYS_SYS_RUN_ENA_NANO
Bit which enables Nano-Beacon during run.
void tdcSetMinTot(uint32_t m_tot)
Sets the HR veto rate per time-slice.
#define SYS_SYS_DISABLE_HV
Bit which disables High Voltage.
uint16_t nano_length
Length of pulse in 16 ns ticks, default is 4 ticks.
void octoResetBoard(int brd)
uint32_t mulhit_ena_ch
Multi-hit enable, bit per channel.
uint16_t nano_period
Period of beacon in 16 ns ticks, default is 0xC35 ticks, or 50us.
#define OPT_STS_WARN_ID
ID is inconsistent.
bool octoInitChan(int brd, int ch, uint8_t highVolt, uint8_t threshold)
Initializes a channel on the octopus board.
bool octoPMTID(int brd, int ch, uint32_t *id, bool *pmtIdFault)
Reads a PMT ID.
uint8_t clbSys2Idx[6]
Mapping from subsystem ID to index.
uint8_t pmt_highvolt[31]
High voltage settings per channel, 0=PMT at location 0, 31=PMT at location 31 Scaling: 0: -700V...
#define logWarn(MSG,...)
Format a log message with warning level.
static void nanoEnable(NanoEnable nanoEnable)
Enable or disable the nano-beacon.
uint8_t chan_status[31]
Channel status, 0=PMT at location 0, 31=PMT at location 31.
#define PRMS_HV_V2DAC(V)
Converts the high voltage value into the high voltage DAC byte value.
#define OCTO_BRD_SMALL
Octo small.
sys_t sys
Provides access to all process variables of subsystem System.
#define OCTO_BRD_LARGE
Octo large.
void tdcSetHRVeto(uint32_t thrs)
Sets the Minimun ToT width allowed.
#define SYS_SYS_FAIL_NANO_STEP_UP
Bit which disables the Nano-beacon step-up regulator.
Manages the global system error.
uint32_t hr_veto_thres
High-rate veto (hits per timeslice)
uint8_t sys_disable
Disable parts of the system.
Undefined => Idle, for internal use only.
void errPrint(bool clear)
Prints the last error.
uint8_t chan_config[31]
Channel configuration (depricated, use CHAN_ENABLE), 0=PMT at location 0, 31=PMT at location 31...
#define TDC_CH_ALL_MASK
All channels.
void errClear()
Clears the current error.
bool octoDeinitChan(int brd, int ch)
De-Initializes a channel on the octopus board.
#define OPT_STS_ENABLED
Enabled.
bool optUpdate()
Updates the status of the optics.
uint8_t sys_run_ena
Run-state Enable mask.
void tdcSetHrvEnabled(uint32_t channels)
Sets on which channels the high-rate veto must be applied.
#define SYS_SYS_DISABLE_NANO_STEP_UP
Bit which disables the Nano-beacon step-up regulator.
#define logError(MSG,...)
Format a log message with fatal level.
#define LOG_DEF(NAME,...)
Define a logger for a module.
The CLB stare module tracks is responsible for state management of the various sub-systems on the CLB...
opt_t opt
Provides access to all process variables of subsystem Optics.
bool octoReadFault(int brd, uint32_t *fault)
Reads the fault register of the CLPD.
static void tdcDisableAll()
Disables all channels.
uint16_t nano_volt
Nano-beacon voltage in millivolts, 0-30000V.
uint16_t nano_delay
Nano-beacon delay in 16 ns ticks.
This driver interfaces with the PROMiS PMT ASIC.
#define PRMS_THRS_MV2DAC(MV)
Converts a threshold value in milliVolts to the DAC value.
bool pwrSetLED(uint32_t mv)
Set the LED output in millivolts.
Implements a generic logger facility.
uint32_t pmt_id[31]
All PMT ID's, 0=PMT at location 0, 31=PMT at location 31.
uint8_t pmt_threshold[31]
Threshold settings per channel, 0=PMT at location 0, 31=PMT at location 31 Scaling: 0: 800mV...
void _clbStateUpdate(int idx, ClbEvent event, uint8_t status)
Invoked by the subsystem to indicate a state change has happened.
bool nano_enable
Enable nano-beacon (deprecated, see SYS_RUN_ENA)
Undefined state (prior to module init, should never be seen on shore)
#define OPT_STS_ERR_COMM
I2C communication error.
void tdcSetChannels(uint32_t channels, uint32_t mask)
Set the enable/disable channels.