versadac  1
versadac - Scalable Recorder Firmware
id_ssm.h
1 /*******************************************************************************
2 FILE : id_ssm.h
3 VERSION : $Id$
4 AUTHOR : David Cozens
5 SYSTEM : Diab C for PowerPC under vxWorks
6 DESCRIPTION : This class is an encapsulation of the SPI scheduled message
7  required to identify a 2500 IO Module.
8 *******************************************************************************/
9 #ifndef __ID_SSM_H
10 #define __ID_SSM_H
11 #include "ee_ssm.h"
12 
13 enum IomIdentEnum
14 {
15  IOM_NO_MODULE = 0,
16  IOM_DI4 = 1,
17  IOM_DI4S = 2,
18  IOM_DI4M = 3,
19  IOM_DI8V = 4,
20  IOM_DI8CC = 5,
21  IOM_DI6_115V = 6,
22  IOM_DI6_230V = 7,
23  IOM_DI16 = 8,
24 
25  IOM_DO4L = 16,
26  IOM_DO4_24V = 17,
27  IOM_DO4S = 18,
28 
29  IOM_PDSIO = 20,
30  IOM_DO8_24 = 21,
31  IOM_DO16_24 = 22,
32 
33  IOM_RLY4 = 32,
34  IOM_RLY6 = 33,
35  IOM_RLY8 = 34,
36 
37  IOM_AI2 = 64,
38  IOM_AI2Z = 65,
39  IOM_ZI2 = 66,
40  IOM_AI3TS = 67,
41  IOM_AI4 = 69,
42 
43  IOM_AI8_TC = 70,
44  IOM_AI8_MA = 71,
45  IOM_AI8_RT = 72,
46  IOM_AI8_CAL = 73,
47  IOM_AI8_FMA = 74,
48 
49  IOM_AO2 = 80,
50 
51  IOM_FI2 = 96,
52  IOM_UNKNOWN = 255
53 };
54 
56 {
57  public:
58  IdentSpiScheduledMessage(unsigned char module );
59  virtual ~IdentSpiScheduledMessage();
60 /*------------------------------------------------------------------------------
61 FUNCTION : getIdent
62 DESCRIPTION : Returns the value of the module identification byte debounced
63  to allow for module resets or occasional comms errors
64 ARGUMENTS :
65 RETURN : enum IomIdentEnum
66 NOTES : This is debounced the last actual can be seen by getRawIdent
67 ------------------------------------------------------------------------------*/
68  unsigned char getIdent(){return m_debouncedIdent;};
69 /*------------------------------------------------------------------------------
70 FUNCTION : getVersion
71 DESCRIPTION : Returns the module version byte
72 ARGUMENTS :
73 RETURN : Version byte - meaning varies from one module type to another.
74 NOTES :
75 ------------------------------------------------------------------------------*/
76  unsigned char getVersion(){return m_debouncedVersion;};
77 
78  virtual void sent();
79 /*------------------------------------------------------------------------------
80 FUNCTION : getIdent
81 DESCRIPTION : Returns the value of the module identification byte debounced
82  to allow for module resets or occasional comms errors
83 ARGUMENTS :
84 RETURN : enum IomIdentEnum
85 NOTES :
86 ------------------------------------------------------------------------------*/
87  unsigned char getRawIdent(){return getDataPtr()[0];};
88 /*------------------------------------------------------------------------------
89 FUNCTION : getVersion
90 DESCRIPTION : Returns the module version byte
91 ARGUMENTS :
92 RETURN : Version byte - meaning varies from one module type to another.
93 NOTES :
94 ------------------------------------------------------------------------------*/
95  unsigned char getRawVersion(){return getDataPtr()[1];};
96 
97 /*------------------------------------------------------------------------------
98 FUNCTION : getProcessWord
99 DESCRIPTION : Returns the modules process word
100 ARGUMENTS :
101 RETURN : Process word
102 NOTES :
103 ------------------------------------------------------------------------------*/
104  unsigned getProcessWord(){return (getRxPtr()[0] << 8) + getRxPtr()[1];};
105 
106 /*------------------------------------------------------------------------------
107 FUNCTION : moduleWasReset
108 DESCRIPTION : This service advises the ident processing code that the module has
109  just been reset. It is used in helping to debounce the module type.
110 ARGUMENTS :
111 RETURN :
112 NOTES : inline
113 ------------------------------------------------------------------------------*/
114  void moduleWasReset() { m_debounceCounter = MAX_DEBOUNCE_COUNTER; };
115 
116  private:
117 
118  unsigned char m_lastIdent;
119  unsigned char m_debouncedIdent;
120  unsigned char m_debouncedVersion;
121  unsigned char m_debounceCounter;
122 
123  static const int NUMBER_OF_NO_MODULES_TO_HIDE = 11;
124  static const int NUMBER_OF_FITTED_RESPONSES_TO_DEBOUNCE = 1;
125  static const int MAX_DEBOUNCE_COUNTER = (NUMBER_OF_NO_MODULES_TO_HIDE+1); // must be the largest of the debounce values above
126 
127 };
128 #endif /*__ID_SSM_H */
129 
Definition: id_ssm.h:55
Definition: ee_ssm.h:59