32 #include "kernel/errata.h"
34 #include "modules/wltune.h"
49 static int _armResetImg = -1;
55 #define MON_FLAGS_AHRS_VALID 0x1 // AHRS data is valid
56 #define MON_TSLICE_DUR 0x2 // Contains timeslice duration
71 static MonData _monData;
73 static uint32_t _tdcFull;
74 static uint32_t _aesFull;
75 static uint32_t _flushCount;
78 static volatile bool _ofListen =
false;
81 static uint32_t _ofTdcEnabledCh;
83 static uint32_t _ofStmEnabledCh;
88 if (!_ofListen)
return;
95 logWarn(
"State-machine overflow, TDC=%08x, AES=%08x", tdcFifo, aesFifo);
96 uint32_t stmFlush = 0;
97 uint32_t ipmFlush = 0;
104 ipmFlush |= IPM_CH_0;
115 ipmFlush |= IPM_CH_1;
132 if (!_ofListen)
return;
164 _monData.flags|= MON_TSLICE_DUR;
168 _monData.tdcFull = _tdcFull;
169 _monData.aesFull = _aesFull;
170 _monData.flushCount = _flushCount;
182 void _subsSysExecEvent (
ClbEvent event)
203 volatile WrxInfo * info =
wrxInfo();
206 WRX_STATUS_MAC_ADDRESS_VALID,
207 WRX_STATUS_MAC_ADDRESS_VALID, 2000))
return;
211 ( info->macAddr[2] << 24 ) |
212 ( info->macAddr[3] << 16 ) |
213 ( info->macAddr[4] << 8 ) |
214 ( info->macAddr[5] );
218 if (errataActive(ERRATA_TEST)) {
219 logInfo(
"Test Errata active!");
277 #ifdef FLUSH_ON_PAUSE
296 #define TCONV(X) (X*503975/4096-273150)/10
298 bool _subsSysUpdate(
ClbState state, uint32_t time)
302 switch (_armResetType) {
308 if (_armResetImg == -1 || _armResetImg >= FLASH_MAX_IMAGES ) _armResetImg =
MBOOT_GOLDEN;
335 sys.
fpga_temp = TCONV(xadcGetMeas(xadcChanTemp, xadcTypeCur));
342 volatile WrxInfo * info =
wrxInfo();
348 + (info->sfpTempFrac * 100) / 256;
372 _armResetType = rTyp;
373 _armResetImg = imgNo;
uint32_t stmachEnabled()
Returns which state-machine channels are enabled.
bool stmachInit(uint32_t domId, void *monbuf, size_t monlen)
Initializes the state-machine with the DOM ID and the monitoring channel CPU data pointer...
bool stmachEnable(uint32_t enable)
Enables one or more STMACH channels.
#define SYS_SYS_TEMP_HUM_WR
Array index of Power board temperature (MAX123)
uint32_t hw_date_rev
Hardware revision (YYMMDDBB hex)
#define MBOOT_GOLDEN
The golden image index position.
This module provides access to the peripherals on the power board.
#define SYS_SYS_RUN_ENA_ACS
Bit which enables Acoustics during run.
This driver is to read and configure the AHRS I2C sensor.
uint16_t stmach_pktsize
Max packet size in bytes as chopped by the HW-StateMachine.
Instrumentation subsystem.
ClbEvent
All state change events.
uint32_t time_slice_dur
Timeslice duration in microseconds.
void mbootLoad(int imgNo)
Boots a specific image.
uint32_t sysHwDateRev()
Returns the Hardware date revision.
void acouOn()
Turns the hydrophone on.
static void _clbStateModErr(int idx)
Invoked by subsystem to indicate an error happened.
uint16_t humid
Humidity in 1/100th RH.
#define STMACH_CH_AES
Bit of state machine AES channel, relative.
uint16_t aes_ts_fifoc
AES timestamp fifo count.
uint16_t pwr_meas[18]
Power measurement readings.
#define SYS_SYS_TEMP_HUM_CLB
Array index of Temperature (SHT21)
void _stmachOverflowEnd(uint32_t tdcFifo, uint32_t aesFifo)
Invoked when an AES or TDC fifo should be enabled again.
Provides access to all variables of the various subsystems.
Low level routines for LM32, including interrupt handling.
White Rabbit simple timer 'Ticks' driver.
ClbState clbState(int idx)
Returns the current clbSubState for the specified subsystem.
void stmachFlush(uint32_t flush, uint8_t op)
Flushes one or more state-machine channels.
System start up and management.
void sysReboot()
Reboot the system.
uint32_t tdcChannels()
Returns which TDC channels are enabled/disabled.
void stmachMUCfg(uint32_t intervalMs)
Configure Monitor Update.
int16_t sys_temp_hum[6]
System temperatures and humidity summery, depreciated All values in 1/100th of a degree or 1/100th of...
Simple task scheduler for tasks.
#define STMACH_CH_TDC
Bit of machine TDC channel, relative.
void ipMuxFlush(uint32_t channelMask, uint8_t ipmFlushOp)
Flushes the IPMUX's FIFO's.
bool wrxInit()
Initializes the whiteRabbit eXchange.
int16_t power_temp
Power board temperature in 1/100th of a degree.
Multiboot Driver, exposes one function, mbootLoad.
CompassData insCompassData
Provides the AHRS data.
void _stmachUpdateMonitor()
Stub function invoked when it is time to update the monitor channel.
uint8_t clbSys2Idx[6]
Mapping from subsystem ID to index.
#define SYS_SYS_RUN_ENA_MON
Bit which enables Monitoring during run.
#define logWarn(MSG,...)
Format a log message with warning level.
bool pwrMeasureAll(uint16_t *results)
Initiates a conversion for the given channel.
uint32_t run_number
The current run number 20160704 Made run number configurable.
Structure defines data from a compass/tilt/gyro sensor.
static void stmachSetRunNo(uint32_t runNo)
Sets the run-number.
static bool timeOutWaitFor(uint32_t *flags, uint32_t mask, uint32_t result, uint32_t msec)
Function to wait for a specific flag to be set or cleared.
sys_t sys
Provides access to all process variables of subsystem System.
uint16_t tdc_ts_fifoc
TDC timestamp fifo count.
Soft reset (Software only)
void acouOff()
Truns the hydrohpone off.
int16_t temp
Temperature in 1/100th of a degree.
void sysArmReset(ResetType rTyp, int imgNo)
Resets the CLB.
Undefined => Idle, for internal use only.
void errPrint(bool clear)
Prints the last error.
bool stmachConfig(uint32_t packSize, uint32_t duration)
Configures the stateMachine.
uint32_t sw_date_rev
Software revision (YYMMDDBB hex)
bool ahrs_valid
Compass data are valid.
#define SYS_SYS_FAIL_PWR_MEAS
Bit which disables the power (voltage/current) measurement.
bool xsLockConfig
Variable to lock or unlock writing of configuration variables.
void _stmachOverflowBegin(uint32_t tdcFifo, uint32_t aesFifo)
Invoked when an AES or TDC fifo overflow occurs.
#define SYS_SYS_TEMP_HUM_CLB_HUM
Array index of Humidity (SHT21)
Force, reset at any point, select image, 0 - golden.
#define TDC_CH_ALL_MASK
All channels.
volatile WrxInfo * wrxInfo()
Returns the whiteRabbit information structure if available, else NULL.
Hard reset, but only if idle, select image, 0 - golden.
uint8_t sys_run_ena
Run-state Enable mask.
int16_t fpga_temp
FPGA core temperature in 1/100th of a degree.
#define SYS_SYS_DISABLE_PWR_MEAS
Bit which disables the power (voltage/current) measurement.
#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...
static void tdcDisableAll()
Disables all channels.
uint32_t sysSwDateRev()
Returns the Software date revision.
ins_t ins
Provides access to all process variables of subsystem Instrumentation.
uint32_t dom_id
DOM identifier.
bool pwrInit()
Initializes the powerboard.
#define SYS_SYS_RUN_ENA_TDC
Bit which enables TDC during run.
Implements a generic logger facility.
Access provides 'introspective' access to process variables.
#define SYS_SYS_TEMP_HUM_PWR
Array index of Power board temperature (MAX123)
WhiteRabbit exchange exchanges information between the 2nd LM32 and WhiteRabbit though a small client...
#define SYS_PWR_MEAS_TEMP_LVL
Array index of Temperature sensor voltage, in millivolts.
#define logInfo(MSG,...)
Write a log message with formatting on info level.
void _clbStateUpdate(int idx, ClbEvent event, uint8_t status)
Invoked by the subsystem to indicate a state change has happened.
#define SYS_SYS_TEMP_HUM_SFP
Array index of SFP Transceiver temperature.
#define SYS_SYS_TEMP_HUM_FPGA
Array index of FPGA core temperature.
void stmachGetStCommit(uint16_t *tdc, uint16_t *aes)
Debug feature: Get TDC and AES state machine Fifo commits.
void tdcSetChannels(uint32_t channels, uint32_t mask)
Set the enable/disable channels.
#define STMACH_CH_MCH
Bit of state machine Monitoring channel, relative.