ConOpSys V2970  P004.07
ANVILEX control operating system
P017_66_KG3_FAN.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file P017_66_KG3_FAN.h
3 //! @brief KG3 Fan I/O board P017.66 V1 T1 hardware driver header file.
4 //! @attention No special attention requered.
5 //! @copyright (C) 2015-2020 ANVILEX LLC
6 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Hardware/P017_66_KG3_FAN/P017_66_KG3_FAN.h $
7 //! $Revision: 2305 $
8 //! $Date: 2020-12-25 03:00:01 +0500 (Fr, 25 Dez 2020) $
9 //! $Author: minch $
10 //------------------------------------------------------------------------------
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are met:
14 //
15 // 1. Redistributions of source code must retain the above copyright notice,
16 // this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright notice,
19 // this list of conditions and the following disclaimer in the documentation
20 // and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of ANVILEX nor the names of its contributors may be
23 // used to endorse or promote products derived from this software without
24 // specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 // POSSIBILITY OF SUCH DAMAGE.
37 //
38 //------------------------------------------------------------------------------
39 
40 //------------------------------------------------------------------------------
41 // Protecting header files from mutual, recursive inclusion.
42 //------------------------------------------------------------------------------
43 
44 #pragma once
45 
46 //------------------------------------------------------------------------------
47 // Include standard libraries header files
48 //------------------------------------------------------------------------------
49 
50 //------------------------------------------------------------------------------
51 // Include thrid party header files
52 //------------------------------------------------------------------------------
53 
54 //------------------------------------------------------------------------------
55 // Include ConOpSys header files
56 //------------------------------------------------------------------------------
57 
58 #include "Functional_Block_Base.h"
59 
60 //------------------------------------------------------------------------------
61 // Include ConOpSys application header files
62 //------------------------------------------------------------------------------
63 
64 //------------------------------------------------------------------------------
65 // Macros
66 //------------------------------------------------------------------------------
67 
68 //------------------------------------------------------------------------------
69 
70 //! @brief Fan input/output interface board P017.66 class
71 class TP017_66_KG3_FAN : public TFunctional_Block_Base
72 {
73 
74  //--------------------------------------------------------------------------
75  // Public defines, methods and variables
76  //--------------------------------------------------------------------------
77 
78  public:
79 
80  //--------------------------------------------------------------------------
81  // Public type declarations
82  //--------------------------------------------------------------------------
83 
84  //! @brief Register structure for fan I/O access
85  typedef struct
86  {
87 
88  //! @brief 0x00 : Unit identification register
90 
91  //! @brief 0x01 : Unit identification register
93 
94  //! @brief Control and status registers
95  union
96  {
97 
98  //! @brief 0x02 : Status register
100 
101  //! @brief 0x02 : Control register
103 
104  };
105 
106  //! @brief 0x03 : Fan supply PWM period register
108 
109  //! @brief 0x04 : Fan supply PWM positive half period register
111 
112  //! @brief 0x05 : Fan supply PWM negative half period register
114 
115  //! @brief 0x06 : Fan speed control PWM carrier period for channel 1
117 
118  //! @brief 0x07 : Fan speed control PWM carrier period for channel 2
120 
121  //! @brief 0x08 : Fan speed control PWM carrier period for channel 3
123 
124  //! @brief 0x09 : Fan speed control PWM setpoint for channel 1
126 
127  //! @brief 0x0A : Fan speed control PWM setpoint for channel 2
129 
130  //! @brief 0x0B : Fan speed control PWM setpoint for channel 3
132 
133  //! @brief 0x0C : Fan speed frequency period for channel 1
135 
136  //! @brief 0x0D : Fan speed frequency period for channel 2
138 
139  //! @brief 0x0E : Fan speed frequency period for channel 3
141 
143 
144  //--------------------------------------------------------------------------
145  // Public methods
146  //--------------------------------------------------------------------------
147 
148  //!-------------------------------------------------------------------------
149  //! @brief Class constructor method.
150  //! @note None
151  //! \par Override
152  //! Not allowed
153  //! @attention Don't call this method directly.
154  //--------------------------------------------------------------------------
155 
157 
158  //!-------------------------------------------------------------------------
159  //! @brief Class destructor method.
160  //! @note None
161  //! \par Override
162  //! Not allowed
163  //! @attention Don't call this method directly.
164  //--------------------------------------------------------------------------
165 
167 
168  //!-------------------------------------------------------------------------
169  //! @brief Hardware mapping method.
170  //! @note None
171  //! @param [in] *struct_Registers_Base_Address - Base adress to register structure mapping
172  //! \par Override
173  //! Not allowed
174  //! @attention None
175  //--------------------------------------------------------------------------
176 
177  VOID Map( TP017_66_KG3_FAN_Registers *struct_Registers_Base_Address );
178 
179  //!-------------------------------------------------------------------------
180  //! @brief Function block initialisation method.
181  //! @note None
182  //! \par Override
183  //! Not allowed
184  //! @attention None
185  //--------------------------------------------------------------------------
186 
187  virtual VOID Init();
188 
189  //!-------------------------------------------------------------------------
190  //! @brief Function block execution method.
191  //! @note None
192  //! \par Override
193  //! Not allowed
194  //! @attention None
195  //--------------------------------------------------------------------------
196 
197  virtual VOID Execute();
198 
200 
202 
203  //!-------------------------------------------------------------------------
204  //! @brief Send information about flow converter board driver over communication link protocol
205  //! @note This method sends information about flow converter driver over specified communication link protocol.
206  //! @param [in] *object_Protocol - Pointer to the communication link protocol
207  //! @return None
208  //! \par Override
209  //! Optional
210  //! @attention None
211  //--------------------------------------------------------------------------
212 
213  virtual VOID Send_Information( TProtocol_Base *object_Protocol );
214 
215  //--------------------------------------------------------------------------
216  // Public variables
217  //--------------------------------------------------------------------------
218 
219  //--------------------------------------------------------------------------
220  // Function block parameter inputs
221  //--------------------------------------------------------------------------
222 
226 
227  //--------------------------------------------------------------------------
228  // Function block input signals
229  //--------------------------------------------------------------------------
230 
232 
236 
240 
241  //--------------------------------------------------------------------------
242  // Function block output signals
243  //--------------------------------------------------------------------------
244 
246 
250 
251  //--------------------------------------------------------------------------
252  // Protected defines, mathods and variables
253  //--------------------------------------------------------------------------
254 
255  protected:
256 
257  //----------------------------------------------------------------------------
258  // Private defines, mathods and variables
259  //--------------------------------------------------------------------------
260 
261  private:
262 
263  //--------------------------------------------------------------------------
264  // Private type declarations
265  //--------------------------------------------------------------------------
266 
267  //! @brief Structure for status register bit parsing
268  typedef union
269  {
271  struct
272  {
276  U16 :1; // Bit 3
280  U16 :1; // Bit 7
284  U16 :1; // Bit 11
285  U16 :1; // Bit 12
286  U16 :1; // Bit 13
287  U16 :1; // Bit 14
288  U16 :1; // Bit 15
289  };
290  } TStatus_Register;
291 
292  //! @brief Structure for control register bit parsing
293  typedef union
294  {
296  struct
297  {
298  U16 bool_Fan_Enable_1:1; // Bit 0
299  U16 bool_Fan_Enable_2:1; // Bit 1
300  U16 bool_Fan_Enable_3:1; // Bit 2
301  U16 :1; // Bit 3
302  U16 :1; // Bit 4
303  U16 :1; // Bit 5
304  U16 :1; // Bit 6
305  U16 :1; // Bit 7
306  U16 :1; // Bit 8
307  U16 :1; // Bit 9
308  U16 :1; // Bit 10
309  U16 :1; // Bit 11
310  U16 :1; // Bit 12
311  U16 :1; // Bit 13
312  U16 :1; // Bit 14
313  U16 :1; // Bit 15
314  };
315  } TControl_Register;
316 
317  //--------------------------------------------------------------------------
318  // Private variables
319  //--------------------------------------------------------------------------
320 
322 
326 
330 
333 
337 
338 };
339 
340 //------------------------------------------------------------------------------
341 // End of file
342 //------------------------------------------------------------------------------
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
float F32
IEEE-754 32-Bit single presession floating point numbers datatype defenition.
Definition: Defines.h:324
unsigned short U16
Binary 16-Bit unsigned integer datatype defenition.
Definition: Defines.h:193
Function block input connector class.
Definition: Block_Input_Connector.h:83
Function block output connector class.
Definition: Block_Output_Connector.h:59
Fan input/output interface board P017.66 class.
Definition: P017_66_KG3_FAN.h:72
TBlock_Input_Connector object_bool_Fan_Enable_2
Definition: P017_66_KG3_FAN.h:234
TBlock_Input_Connector object_f32_Fan_Speed_Setpoint_2
Definition: P017_66_KG3_FAN.h:238
TBlock_Input_Connector object_bool_Fan_Enable_3
Definition: P017_66_KG3_FAN.h:235
TBlock_Input_Connector object_f32_Speed_Control_PWM_Carrier_Frequency_Channel_2
Definition: P017_66_KG3_FAN.h:224
F32 f32_Fan_Speed_PWM_Setpoint_2
Definition: P017_66_KG3_FAN.h:328
TBlock_Input_Connector object_f32_Speed_Control_PWM_Carrier_Frequency_Channel_1
Definition: P017_66_KG3_FAN.h:223
TBlock_Input_Connector object_f32_Fan_Speed_Setpoint_1
Definition: P017_66_KG3_FAN.h:237
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about flow converter board driver over communication link protocol.
Definition: P017_66_KG3_FAN.cpp:597
TBlock_Output_Connector object_f32_Fan_Supply_Voltage
Definition: P017_66_KG3_FAN.h:245
F32 f32_PWM_Maximum_Setpoint_1
Definition: P017_66_KG3_FAN.h:323
F32 f32_Supply_Voltage
Definition: P017_66_KG3_FAN.h:332
F32 f32_Fan_Speed_2
Definition: P017_66_KG3_FAN.h:335
F32 f32_Fan_Speed_PWM_Setpoint_1
Definition: P017_66_KG3_FAN.h:327
F32 f32_Fan_Speed_1
Definition: P017_66_KG3_FAN.h:334
virtual VOID Execute()
Function block execution method.
Definition: P017_66_KG3_FAN.cpp:197
TBlock_Input_Connector object_bool_Fan_Enable_1
Definition: P017_66_KG3_FAN.h:233
volatile TP017_66_KG3_FAN_Registers * struct_Registers
Definition: P017_66_KG3_FAN.h:321
VOID Execute_Outputs()
Definition: P017_66_KG3_FAN.cpp:411
F32 f32_Fan_Speed_3
Definition: P017_66_KG3_FAN.h:336
virtual VOID Init()
Function block initialisation method.
Definition: P017_66_KG3_FAN.cpp:178
F32 f32_PWM_Maximum_Setpoint_3
Definition: P017_66_KG3_FAN.h:325
TBlock_Output_Connector object_f32_Fan_Speed_1
Definition: P017_66_KG3_FAN.h:247
VOID Execute_Inputs()
Definition: P017_66_KG3_FAN.cpp:212
TBlock_Output_Connector object_f32_Fan_Speed_2
Definition: P017_66_KG3_FAN.h:248
TBlock_Input_Connector object_f32_Speed_Control_PWM_Carrier_Frequency_Channel_3
Definition: P017_66_KG3_FAN.h:225
TBlock_Output_Connector object_f32_Fan_Speed_3
Definition: P017_66_KG3_FAN.h:249
~TP017_66_KG3_FAN()
Class destructor method.
Definition: P017_66_KG3_FAN.cpp:155
VOID Map(TP017_66_KG3_FAN_Registers *struct_Registers_Base_Address)
Hardware mapping method.
Definition: P017_66_KG3_FAN.cpp:163
F32 f32_Supply_Voltage_Period
Definition: P017_66_KG3_FAN.h:331
TBlock_Input_Connector object_bool_Supply_Enable
Definition: P017_66_KG3_FAN.h:231
F32 f32_Fan_Speed_PWM_Setpoint_3
Definition: P017_66_KG3_FAN.h:329
TP017_66_KG3_FAN()
Class constructor method.
Definition: P017_66_KG3_FAN.cpp:70
F32 f32_PWM_Maximum_Setpoint_2
Definition: P017_66_KG3_FAN.h:324
TBlock_Input_Connector object_f32_Fan_Speed_Setpoint_3
Definition: P017_66_KG3_FAN.h:239
Definition: Protocol_Base.h:57
Register structure for fan I/O access.
Definition: P017_66_KG3_FAN.h:86
U16 u16_Fan_Speed_Control_PWM_Period_Channel_3
0x08 : Fan speed control PWM carrier period for channel 3
Definition: P017_66_KG3_FAN.h:122
U16 u16_Fan_Speed_Control_PWM_Period_Channel_1
0x06 : Fan speed control PWM carrier period for channel 1
Definition: P017_66_KG3_FAN.h:116
U16 u16_Fan_Speed_Control_PWM_Period_Channel_2
0x07 : Fan speed control PWM carrier period for channel 2
Definition: P017_66_KG3_FAN.h:119
U16 u16_Fan_Speed_Control_PWM_Setpoint_Channel_3
0x0B : Fan speed control PWM setpoint for channel 3
Definition: P017_66_KG3_FAN.h:131
U16 u16_Fan_Speed_Control_PWM_Setpoint_Channel_1
0x09 : Fan speed control PWM setpoint for channel 1
Definition: P017_66_KG3_FAN.h:125
U16 u16_Fan_Speed_Status_Period_Channel_1
0x0C : Fan speed frequency period for channel 1
Definition: P017_66_KG3_FAN.h:134
U16 u16_Fan_Speed_Status_Period_Channel_2
0x0D : Fan speed frequency period for channel 2
Definition: P017_66_KG3_FAN.h:137
U16 u16_Supply_PWM_Positive_Half_Period
0x04 : Fan supply PWM positive half period register
Definition: P017_66_KG3_FAN.h:110
U16 u16_Fan_Speed_Status_Period_Channel_3
0x0E : Fan speed frequency period for channel 3
Definition: P017_66_KG3_FAN.h:140
U16 u16_Unit_ID_L
0x00 : Unit identification register
Definition: P017_66_KG3_FAN.h:89
U16 u16_Supply_PWM_Period
0x03 : Fan supply PWM period register
Definition: P017_66_KG3_FAN.h:107
U16 u16_Fan_Speed_Control_PWM_Setpoint_Channel_2
0x0A : Fan speed control PWM setpoint for channel 2
Definition: P017_66_KG3_FAN.h:128
U16 u16_Unit_ID_H
0x01 : Unit identification register
Definition: P017_66_KG3_FAN.h:92
U16 u16_Supply_PWM_Negative_Half_Period
0x05 : Fan supply PWM negative half period register
Definition: P017_66_KG3_FAN.h:113
U16 u16_Control
0x02 : Control register
Definition: P017_66_KG3_FAN.h:102
U16 u16_Status
0x02 : Status register
Definition: P017_66_KG3_FAN.h:99
U16 u16_Control
Definition: P017_66_KG3_FAN.h:295
U16 bool_Fan_Enable_2
Definition: P017_66_KG3_FAN.h:299
U16 bool_Fan_Enable_1
Definition: P017_66_KG3_FAN.h:298
U16 bool_Fan_Enable_3
Definition: P017_66_KG3_FAN.h:300
U16 u16_Supply_PWM_Positive_Half_Period_Valid
Definition: P017_66_KG3_FAN.h:274
U16 u16_Supply_Channel_3_Overload
Definition: P017_66_KG3_FAN.h:279
U16 u16_Supply_Channel_1_Overload
Definition: P017_66_KG3_FAN.h:277
U16 u16_Speed_Status_Carrier_Period_Channel_3_Valid
Definition: P017_66_KG3_FAN.h:283
U16 u16_Supply_Channel_2_Overload
Definition: P017_66_KG3_FAN.h:278
U16 u16_Speed_Status_Carrier_Period_Channel_1_Valid
Definition: P017_66_KG3_FAN.h:281
U16 u16_Speed_Status_Carrier_Period_Channel_2_Valid
Definition: P017_66_KG3_FAN.h:282
U16 u16_Supply_PWM_Negative_Half_Period_Valid
Definition: P017_66_KG3_FAN.h:275
U16 u16_Status
Definition: P017_66_KG3_FAN.h:270
U16 u16_Supply_PWM_Period_Valid
Definition: P017_66_KG3_FAN.h:273