versadac  1
versadac - Scalable Recorder Firmware
eiot2sro2f.h
1 /*******************************************************************************
2 FILE : eiot2sro2f.h
3 VERSION : $Id$
4 AUTHOR : David Cozens/Phil Windsor
5 SYSTEM : Diab C for PowerPC under vxWorks
6 DESCRIPTION : This file contains The t2500 module classes
7 
8  Modification for 8Hz execution (for Scalable Recorder)
9 
10 *******************************************************************************/
11 
12 #ifndef __EIOT2SRO2F_H
13 #define __EIOT2SRO2F_H
14 /* The following section is needed by eio_t25.c */
15 
16 #ifdef __cplusplus
17 
18 /* Any C++ code should be added after this point */
19 #include "eio_t25srm.h"
20 #include "dfc_ssm.h"
21 #include "rst_ssm.h"
22 #include "led_ssm.h"
23 #include "eiot2srao2.h"
24 
25 extern "C" {
26 
27 enum Ao2FastRunStates
28 {
29  EIO_T2500AO2FAST_STATE_JUST_CREATED,
30  EIO_T2500AO2FAST_STATE_MODULE_HAS_CHANGED,
31  EIO_T2500AO2FAST_STATE_INITIALISING,
32  EIO_T2500AO2FAST_STATE_RUNTIME,
33  EIO_T2500AO2FAST_STATE_DELETE,
34  EIO_T2500AO2FAST_STATE_SECONDARY,
35  EIO_T2500AO2FAST_STATE_BECOMING_PRIMARY_1,
36  EIO_T2500AO2FAST_STATE_BECOMING_PRIMARY_2,
37 };
38 
39 
40 class EioT2500AO2FastModule:public EioT2500Module
41 {
42  public:
43  EioT2500AO2FastModule(unsigned char moduleNumber, EioT2500CycleEnum z_expectedCycleNumber);
44  virtual ~EioT2500AO2FastModule();
45 
46  protected:
47  virtual void updateFast(unsigned short slot);
48  virtual void update62_5mS();
49  virtual void updateFastBuffers(unsigned int z_thisSlot);
50  virtual void update125mS();
51  virtual void cycleCompleteFast(unsigned int z_thisSlot);
52 
53  private:
54  bool decipherCalibration(int z_channel);
55 
56  EioUint16 eeCheckCal( AOC_CAL_DATA_T *z_calData );
57  void driveChannelLeds();
58  void disableAllDfcMessages();
59  EioUint16 getCounts(int z_channel);
60  int channelToPort(int z_channel){return 1-z_channel;};
61  void generatePointStatus();
62  void updateEepromData125mS();
63  void updateCalibrationState();
64  void enableIocTotalConfig();
65 
66  Ao2FastRunStates m_state;
67  Ao2EepromAccessState m_eepromState;
68  Ao2CalibrationState m_calibrationState[AO2_NUMBER_OF_CHANNELS];
69 
70  bool m_rangeCalibrated[AO2_NUMBER_OF_CHANNELS][AO2_NUMBER_OF_CALIBRATION_RANGES];
71  EioBoolean m_rangeUserCalibrated[AO2_NUMBER_OF_CHANNELS][AO2_NUMBER_OF_CALIBRATION_RANGES];
72 
73  static float m_calScaleFactor;
74  static float m_calibrationRefLow[AO2_NUMBER_OF_CALIBRATION_RANGES];
75  static float m_calibrationRefHigh[AO2_NUMBER_OF_CALIBRATION_RANGES];
76  static Ao2CalibrationRangeEnum m_calType[EIO_AO_NUMBER_OF_TYPES];
77  static EioAOType m_calOutputType[AO2_NUMBER_OF_CALIBRATION_RANGES];
78 
79  Ao2CalibrationPoints m_calPointIndex[AO2_NUMBER_OF_CHANNELS];
80  float m_actualCalValue[AO2_NUMBER_OF_CHANNELS][AO2_NUMBER_OF_CALIBRATION_POINTS];
81  float m_measuredValue[AO2_NUMBER_OF_CHANNELS][AO2_NUMBER_OF_CALIBRATION_POINTS];
82 
83 
84  // recovery messages
85  DfcDelaySpiScheduledMessage * m_delayMessage;
86  DfcDelaySpiScheduledMessage * m_delayMessage2;
87  ResetSpiScheduledMessage * m_resetMessage;
88  DfcDataReadySpiScheduledMessage * m_ledCh1Message;
89  DfcVWireSpiScheduledMessage * m_ledCh2Message;
90  DfcTotalConfigSpiScheduledMessage * m_dfcTotalConfigMessage;
91 
92  EEReadSpiScheduledMessage * m_eereadCalibration[AO2_NUMBER_OF_CHANNELS];
93  EEWriteEnableSpiScheduledMessage * m_eeenableWriteCalibration;
94  EEWriteSpiScheduledMessage * m_eewriteCalibration;
95 
96  LedSpiScheduledMessage * m_moduleLed;
97 
98  DfcIocTotalConfigSpiScheduledMessage * m_iocTotalConfigMessage[AO2_NUMBER_OF_CHANNELS];
99  DfcIocTotalConfigSpiScheduledMessage * m_iocTotalConfigMessageFast[AO2_NUMBER_OF_CHANNELS];
100  DfcIocLimitOutputSpiScheduledMessage * m_iocLimitOutputMessage[AO2_NUMBER_OF_CHANNELS];
101  DfcIocDriveOutputSpiScheduledMessage * m_iocDriveOutputMessage[AO2_NUMBER_OF_CHANNELS];
102  DfcReadFilterCountSpiScheduledMessage * m_DfcReadFilterCountSpiScheduledMessage[AO2_NUMBER_OF_CHANNELS];
103 
104  DfcIocLimitOutputSpiScheduledMessage * m_fastIocLimitOutputMessage[EUROTHERM_SPI_MESSAGE_SCHEDULER_NUMBER_OF_SLOTS*AO2_NUMBER_OF_CHANNELS];
105  DfcIocDriveOutputSpiScheduledMessage * m_fastIocDriveOutputMessage[EUROTHERM_SPI_MESSAGE_SCHEDULER_NUMBER_OF_SLOTS*AO2_NUMBER_OF_CHANNELS];
106 
107  bool m_haveReadValidCalibration[AO2_NUMBER_OF_CHANNELS];
108 
109  AOC_EE_CAL_DATA_T m_calibrationData[AO2_NUMBER_OF_CHANNELS];
110  AOC_EE_CAL_DATA_T m_oldCalData[AO2_NUMBER_OF_CHANNELS];
111  EioAOCalibrationData m_calSMData[AO2_NUMBER_OF_CHANNELS]; // used in the calibration state machine
112 
113  EioAOStatus m_pointStatus[AO2_NUMBER_OF_CHANNELS];
114  EioAOStatus m_localStatus[AO2_NUMBER_OF_CHANNELS];
115  float m_demand[AO2_NUMBER_OF_CHANNELS];
116  EioAOConfig m_pointConfig[AO2_NUMBER_OF_CHANNELS];
117  EioAOConfig m_workingPointConfig[AO2_NUMBER_OF_CHANNELS];
118 
119  bool m_clippedLow[AO2_NUMBER_OF_CHANNELS];
120  bool m_clippedHigh[AO2_NUMBER_OF_CHANNELS];
121  bool m_capabilitiesExceeded[AO2_NUMBER_OF_CHANNELS];
122  bool m_iocError[AO2_NUMBER_OF_CHANNELS];
123  bool m_hadHardwareError[AO2_NUMBER_OF_CHANNELS];
124  bool m_forceFastUpdateDisable[AO2_NUMBER_OF_CHANNELS];
125  EioUint8 m_lastHeartBeat[AO2_NUMBER_OF_CHANNELS];
126 
127  EioSint8 m_rangingTrapCounter[AO2_NUMBER_OF_CHANNELS];
128 
129  EioUint8 m_retryCounter;
130 
131  bool m_messagesScheduled;
132  EioUint8 m_resetCounter;
133  bool m_iocFilterValid;
134  bool m_heartbeatValid;
135  EioUint8 m_rangingCounter;
136  EioUint8 m_firstSlot125ms;
137  EioUint8 m_fastIocTotalConfigSlot;
138  bool m_deleting;
139 };
140 
141 } /* extern "C" */
142 #endif /* __cplusplus */
143 #endif /*__EIOT2SRO2F_H */
144 
Definition: eio_t25srm.h:58
Definition: dfc_ssm.h:340
Definition: eio_ao.h:46
Definition: dfc_ssm.h:399
Definition: dfc_ssm.h:198
Definition: ee_ssm.h:113
Definition: dfc_ssm.h:363
Definition: rst_ssm.h:14
Definition: dfc_ssm.h:233
Definition: led_ssm.h:12
Definition: dfc_ssm.h:206
Definition: dfc_ssm.h:379
Definition: ee_ssm.h:126
Definition: eiot2cal.h:61
Definition: ee_ssm.h:59
Definition: dfc_ssm.h:352