INOS
cinosprocessimagevalues.h
Go to the documentation of this file.
1 //******************************************************************************
27 //******************************************************************************
28 
29 #ifndef INC_CINOSPROCESSIMAGEVALUES_H
30 #define INC_CINOSPROCESSIMAGEVALUES_H
31 
32 //------------------------------------------------------------------------------
33 // defines
34 //------------------------------------------------------------------------------
35 //
36 // --- process image value CONFIG ----------------------------------------------
37 //
38 // masks
39 #define DF_INOS_IMAGE_VALUE_CFG_MASK_SYSTEM 0xFFFF0000 // config system area
40 #define DF_INOS_IMAGE_VALUE_CFG_MASK_INP 0x000F0000 // config input
41 #define DF_INOS_IMAGE_VALUE_CFG_MASK_OUT 0x00F00000 // config output
42 #define DF_INOS_IMAGE_VALUE_CFG_MASK_USER 0x0000FFFF // config user area
43 //
44 // patterns
45 #define DF_INOS_IMAGE_VALUE_CFG_ENABLED 0x80000000 // config enabled
46 #define DF_INOS_IMAGE_VALUE_CFG_OVERWRITE 0x40000000 // config overwrite mode
47 #define DF_INOS_IMAGE_VALUE_CFG_ERROR 0x20000000 // config error
48 #define DF_INOS_IMAGE_VALUE_CFG_WARNING 0x10000000 // config warning
49 // config linked channel (e.g. DAC channel belonging to POS channel)
50 #define DF_INOS_IMAGE_VALUE_CFG_LINKED 0x10000000
51 #define DF_INOS_IMAGE_VALUE_CFG_SIMULATED 0x08000000 // config simulated
52 #define DF_INOS_IMAGE_VALUE_CFG_OFFLINE 0x04000000 // config channel offline
53 //
54 // bit numbers
55 #define DF_INOS_IMAGE_VALUE_NBR_ENABLED 31 // config enabled
56 #define DF_INOS_IMAGE_VALUE_NBR_OVERWRITE 30 // config overwrite mode
57 #define DF_INOS_IMAGE_VALUE_NBR_ERROR 29 // config error
58 #define DF_INOS_IMAGE_VALUE_NBR_WARNING 28 // config warning
59 #define DF_INOS_IMAGE_VALUE_NBR_LINKED 28 // config linked
60 #define DF_INOS_IMAGE_VALUE_NBR_SIMULATED 27 // config simulated
61 //
62 //------------------------------------------------------------------------------
63 // includes
64 //------------------------------------------------------------------------------
65 //
66 // system
67 //
68 // C++
69 //
70 // project
71 //
72 //------------------------------------------------------------------------------
73 // class definition
74 //------------------------------------------------------------------------------
75 //
76 class CINOSBusPortHandler;
78 {
79  //--- user interface ---------------------------------------------------
80 
81  // public member functions
82  public :
83  #if defined(INOS_PROCESSIMAGE_OVERWRITE)
84  virtual void SetOverwrite(bool abValue) override;
85  //; change the whole process image from real to overwrite mode if
86  //; abValue = true or vice versa
87  virtual bool GetOverwrite() override;
88  //; get actual overwrite mode of the whole process image
89  virtual void SetOverwrite(uint16 auNumber, bool abValue) override;
90  //; change the channel 'auNumber' from real to overwrite mode if
91  //; abValue = true or vice versa
92  ICACHE virtual bool GetOverwrite(uint16 auNumber) override;
93  //; get actual overwrite mode of channel 'auNumber'
94  #endif
95 
96  virtual void SetEnabled(bool abValue) override;
97  //; enable whole process image if abValue = true or vice versa
98  virtual bool GetEnabled() override;
99  //; return true if the whole process image is enabled
100  virtual void SetEnabled(uint16 auNumber, bool abValue) override;
101  //; enable the channel 'auNumber' if abValue = true or vice versa
102  virtual bool GetEnabled(uint16 auNumber) override;
103  //; return true if channel 'auNumber' is enabled
104 
105  virtual void SetSimulated(uint16 auNumber, bool abValue) override;
106  //; set simulated state of channel auNumber
107  virtual bool GetSimulated(uint16 auNumber) override;
108  //; get simulated state of channel auNumber
109 
110  virtual void SetConfig(uint16 auNumber, uint32 auConfig, uint32 auMask,
111  uint32 auOffset=0) override;
112  //; set config of channel 'auNumber' to auConfig (only bits set in
113  //; auMask are affected)
114  virtual uint32 GetConfig(uint16 auNumber, uint32 auOffset=0) override;
115  //; get config of channel 'auNumber'
116  virtual void* GetConfigAdr(uint16 auNumber, uint32 auOffset=0) override;
117  //; get config address of channel 'auNumber'
118 
119  virtual void* GetConfigBaseAddress() override;
120  //; get base address of process image config
121 
122  virtual uint16 GetCycleNumber(uint16 auNumber) override;
123  //; return bus subcycle number the channel is updated (needed to be
124  //; able to register bus hook in the correct subcycle)
125  virtual void SetCycleNumber(uint16 auNumber, uint16 auCycleNumber, uint8 auBusId = CINOSBus::GetFirstBus()->GetId(),
126  CINOSBusJob* apBusJob = 0) override;
127  //; set bus id and subcycle number the channel is updated (the field bus
128  //; driver has to set this number to inform all others who are
129  //; interested in)
130  virtual uint16 GetCycleId(uint16 auNumber) override;
131  //; return bus cycle id the channel is updated (needed to be
132  //; able to register bus hook in the correct cycle/core)
133  virtual void SetCycleId(uint16 auNumber, uint16 auCycleId, uint8 auBusId,
134  CINOSBusPortHandler* apBusPortHandler) override;
135  //; set bus id and cycle id the channel is updated (the field bus
136  //; driver has to set this number to inform all others who are
137  //; interested in)
138  virtual void UpdateCycleId(uint16 auNumber, uint16 auCycleId) override;
139  //; update cycle id the channel is updated (this method is usually called
140  //; from axis controllers to inform about downsampled controlling and possible
141  //; other cores)
142  virtual uint8 GetBusId(uint16 auNumber) override;
143  //; return bus id the channel belongs to (needed to be
144  //; able to register bus hook)
145  virtual CINOSBusJob* GetBusJob(uint16 auNumber) override;
146  //; return pointer to the according bus job (or 0 if not available)
147  virtual CINOSBusPortHandler* GetBusPortHandler(uint16 auNumber) override;
148  //; return pointer to the according bus port (or 0 if not available)
149 
154  virtual void SetBusPortHandler(uint16 auNumber, CINOSBusPortHandler* apPortHandler);
155 
156 
157  //--- internals --------------------------------------------------------
158 
159  friend class CINOSProcessImageValue;
160 
161  // constructor / destructor
162  public :
163  CINOSProcessImageValues (char* apName, uint32 auNumber, void* apImage);
164  //; object constructor
165 
166  // public member functions but just for internal use
167  public :
168  #if defined(INOS_PROCESSIMAGE_OVERWRITE)
169  ICACHE virtual void Set(uint16 auChannel, void* apValue,
170  bool abOverwrite = false) override;
171  //; set channel to apValue
172  //; (abOverwrite=true -> value always set, abOverwrite=false -> value
173  //; set if channel is NOT in overwrite mode)
174  ICACHE virtual void Set64(uint16 auChannel, void* apValue,
175  bool abOverwrite = false);
176  //; set channel to apValue
177  //; (abOverwrite=true -> value always set, abOverwrite=false -> value
178  //; set if channel is NOT in overwrite mode)
179  #else
180  ICACHE virtual void Set(uint16 auChannel, void* apValue) override;
181  //; set channel to apValue
182  ICACHE virtual void Set64(uint16 auChannel, void* apValue);
183  //; set channel to apValue
184  #endif
185  virtual void MoveChannel(uint16 auOldNumber, uint16 auNewNumber) override;
186  //; move channel auOldNumber to auNewNumber
187 
188  // public members but just for internal use
189  public :
190  uint32* m_pLatched;
191  //; pointer to latched data
192  uint32* m_pConfig;
193  //; pointer to config data
194  uint16* m_pCycleNumber;
195  //; pointer to cycle number data
196  uint8* m_pBusId;
197  //; pointer to bus id data
198  void** m_pBusJobOrPortHandler;
199  //; pointer to either bus job or bus port handler
200 };
201 
202 //
203 //------------------------------------------------------------------------------
204 // global variables
205 //------------------------------------------------------------------------------
206 //
207 //
208 //------------------------------------------------------------------------------
209 // end of file
210 //------------------------------------------------------------------------------
211 
212 #endif // INC_CINOSPROCESSIMAGEVALUES_H
CINOSProcessImage
Definition: cinosprocessimage.h:70
CINOSProcessImageValue
Definition: cinosprocessimagevalue.h:51
CINOSProcessImageValues
Definition: cinosprocessimagevalues.h:77
CINOSBus::GetFirstBus
static CINOSBus * GetFirstBus()
Return first valid bus (aka "g_pBus[0]").
Definition: cinosbus.h:604
CINOSProcessImageValues::SetBusPortHandler
virtual void SetBusPortHandler(uint16 auNumber, CINOSBusPortHandler *apPortHandler)
Set port handler at channel number.