ConOpSys V2970  P004.07
ANVILEX control operating system
P016_26_KG3_TSA.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file P016_26_KG3_TSA.h
3 //! @brief Board P016.26 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/P016_26_KG3_TSA/P016_26_KG3_TSA.h $
7 //! $Revision: 2268 $
8 //! $Date: 2020-12-06 14:59:59 +0500 (So, 06 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 // TP016_26_KG3_TSA_T1
41 //
42 //------------------------------------------------------------------------------
43 
44 //------------------------------------------------------------------------------
45 // Protecting header files from mutual, recursive inclusion.
46 //------------------------------------------------------------------------------
47 
48 #pragma once
49 
50 //------------------------------------------------------------------------------
51 // Include standard libraries header files
52 //------------------------------------------------------------------------------
53 
54 //------------------------------------------------------------------------------
55 // Include thrid party header files
56 //------------------------------------------------------------------------------
57 
58 //------------------------------------------------------------------------------
59 // Include ConOpSys header files
60 //------------------------------------------------------------------------------
61 
62 #include "Functional_Block_Base.h"
63 
64 //------------------------------------------------------------------------------
65 // Include ConOpSys application header files
66 //------------------------------------------------------------------------------
67 
68 //------------------------------------------------------------------------------
69 // Macros
70 //------------------------------------------------------------------------------
71 
72 //!------------------------------------------------------------------------------
73 //! @brief Analog current input KG3 BLA T1 (P018.39) board class
74 //------------------------------------------------------------------------------
75 
76 class TP016_26_KG3_TSA_T1 : public TFunctional_Block_Base
77 {
78 
79  //----------------------------------------------------------------------------
80  // Public defines, methods and variables
81  //----------------------------------------------------------------------------
82 
83  public:
84 
85  // Register structure for generic access
86  typedef struct
87  {
88 
89  // Unit identification registers
90  U16 u16_Unit_ID_L; //!< 0x00 : Module identification register
91  U16 u16_Unit_ID_H; //!< 0x01 : Module identification register
92 
93  U16 u16_Unused_0x02; //!< 0x02 : Reserved register
94  U16 u16_Unused_0x03; //!< 0x03 : Reserved register
95 
96  U16 u16_Control_Register; //!< 0x04 : Control register
97  U16 u16_Status_Register; //!< 0x05 : Control register
98 
99  U16 u16_ISP_Data_1; //!< 0x06 : ISP data 1 register
100  U16 u16_ISP_Data_2; //!< 0x07 : ISP data 2 register
101  U16 u16_ISP_Data_3; //!< 0x08 : ISP data 3 register
102  U16 u16_ISP_Data_4; //!< 0x09 : ISP data 4 register
103 
105 
106  //--------------------------------------------------------------------------
107  // Public methods
108  //--------------------------------------------------------------------------
109 
110  // Constructor and destructor
111  TP016_26_KG3_TSA_T1(); //!< Class constructor method
112  ~TP016_26_KG3_TSA_T1(); //!< Class destructor method
113 
114  VOID Map( TP016_26_KG3_TSA_T1_Registers *struct_Registers_Base_Address ); //!< Hardware map method
115  virtual VOID Init(); //!< Block initialisation method
116  virtual VOID Execute(); //!< Block execution method
117  virtual VOID Send_Information( TProtocol_Base *object_Protocol ); //!< Send information method
118 
119  //--------------------------------------------------------------------------
120  // Block parameters
121  //--------------------------------------------------------------------------
122 
123  TBlock_Input_Connector object_f32_Sample_Time; //!< Functional block sample time input
124 
125  //--------------------------------------------------------------------------
126  // Block inputs
127  //--------------------------------------------------------------------------
128 
132 
135 
138 
139  //--------------------------------------------------------------------------
140  // Block outputs
141  //--------------------------------------------------------------------------
142 
145 
146  //----------------------------------------------------------------------------
147  // Protected defines, methods and variables
148  //----------------------------------------------------------------------------
149 
150  protected:
151 
152  //----------------------------------------------------------------------------
153  // Private defines, methods and variables
154  //----------------------------------------------------------------------------
155 
156  private:
157 
158  typedef enum
159  {
160 
161  enum_Init, //!< Initialisation state
162  enum_Ready, //!< Ready state
164 
168 
172 
176 
181 
185 
186  enum_Error
187 
188  } TGlobal_FSM_State; //!< FSM state definition
189 
190  typedef union
191  {
192 
194  struct
195  {
196 
199  U16 :1; // Bit 2
200  U16 :1; // Bit 3
201 
202  U16 :1; // Bit 4
203  U16 :1; // Bit 5
204  U16 :1; // Bit 6
205  U16 :1; // Bit 7
206 
207  U16 :1; // Bit 8
208  U16 :1; // Bit 9
209  U16 u16_ISP_Ready:1; // Bit 10
210  U16 :1; // Bit 11
211 
212  U16 :1; // Bit 12
213  U16 :1; // Bit 13
214  U16 u16_ISP_MISO:1; // Bit 14
215  U16 :1; // Bit 15
216 
217  };
218 
219  } TStatus_Register;
220 
221  typedef union
222  {
224  struct
225  {
226  U16 u16_LED_Red:1; // Bit 0
227  U16 u16_LED_Yellow:1; // Bit 1
228  U16 u16_LED_Green:1; // Bit 2
229  U16 :1; // Bit 3
230  U16 u16_Clock_Enable:1; // Bit 4
231  U16 :1; // Bit 5
232  U16 :1; // Bit 6
233  U16 :1; // Bit 7
234  U16 u16_ISP_Enable:1; // Bit 8
235  U16 u16_ISP_Mode:1; // Bit 9
236  U16 u16_ISP_Start:1; // Bit 10
237  U16 u16_ISP_Reset:1; // Bit 11
238  U16 u16_ISP_SCK:1; // Bit 12
239  U16 u16_ISP_MOSI:1; // Bit 13
240  U16 :1; // Bit 14
241  U16 :1; // Bit 15
242  };
243  } TControl_Register;
244 
245  volatile TP016_26_KG3_TSA_T1_Registers *struct_Registers; //!< Hardware mapped registers
246 
248 
251 
253 
259 
262 
265 
266 };
267 
268 //------------------------------------------------------------------------------
269 // End Of File
270 //------------------------------------------------------------------------------
unsigned char U8
Binary 8-Bit unsigned integer datatype defenition.
Definition: Defines.h:183
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
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
Analog current input KG3 BLA T1 (P018.39) board class.
Definition: P016_26_KG3_TSA.h:77
TBlock_Input_Connector object_u16_Command
Definition: P016_26_KG3_TSA.h:136
TBlock_Input_Connector object_bool_ISP_Connect
Definition: P016_26_KG3_TSA.h:133
TBlock_Input_Connector object_bool_LED_Red_Enable
Definition: P016_26_KG3_TSA.h:129
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send information method.
Definition: P016_26_KG3_TSA.cpp:1055
TGlobal_FSM_State enum_FSM_State
FSM state.
Definition: P016_26_KG3_TSA.h:247
TControl_Register struct_Control_Register
Definition: P016_26_KG3_TSA.h:249
TBlock_Output_Connector object_bool_Processed
Definition: P016_26_KG3_TSA.h:143
U8 u8_Device_Signature[4]
Definition: P016_26_KG3_TSA.h:258
VOID ISP_Send_Progrsmming_Enable_Command()
Definition: P016_26_KG3_TSA.cpp:1038
virtual VOID Init()
Block initialisation method.
Definition: P016_26_KG3_TSA.cpp:266
TBlock_Input_Connector object_bool_Start
Definition: P016_26_KG3_TSA.h:137
TP016_26_KG3_TSA_T1()
Class constructor method.
Definition: P016_26_KG3_TSA.cpp:182
U32 u32_Page_Counter
Definition: P016_26_KG3_TSA.h:256
U32 u32_Program_Memory_Buffer_Index
Definition: P016_26_KG3_TSA.h:257
TStatus_Register struct_Status_Register
Definition: P016_26_KG3_TSA.h:250
volatile TP016_26_KG3_TSA_T1_Registers * struct_Registers
Hardware mapped registers.
Definition: P016_26_KG3_TSA.h:245
~TP016_26_KG3_TSA_T1()
Class destructor method.
Definition: P016_26_KG3_TSA.cpp:239
U32 u32_Byte_Counter
Definition: P016_26_KG3_TSA.h:255
TBlock_Input_Connector object_bool_LED_Green_Enable
Definition: P016_26_KG3_TSA.h:131
TBlock_Input_Connector object_f32_Sample_Time
Functional block sample time input.
Definition: P016_26_KG3_TSA.h:123
U8 u8_Program_Memory_Read_Data[1024]
Definition: P016_26_KG3_TSA.h:261
TBlock_Input_Connector object_bool_LED_Yellow_Enable
Definition: P016_26_KG3_TSA.h:130
VOID ISP_Send_Chip_Erase_Command()
Definition: P016_26_KG3_TSA.cpp:1044
VOID Map(TP016_26_KG3_TSA_T1_Registers *struct_Registers_Base_Address)
Hardware map method.
Definition: P016_26_KG3_TSA.cpp:250
TGlobal_FSM_State
Definition: P016_26_KG3_TSA.h:159
@ enum_Read_Device_Signature
Definition: P016_26_KG3_TSA.h:169
@ enum_Chip_Erase_Wait
Definition: P016_26_KG3_TSA.h:174
@ enum_Read_Program_Memory_Done
Definition: P016_26_KG3_TSA.h:184
@ enum_Read_Program_Memory
Definition: P016_26_KG3_TSA.h:182
@ enum_Read_Program_Memory_Wait
Definition: P016_26_KG3_TSA.h:183
@ enum_Programming_Enable_Done
Definition: P016_26_KG3_TSA.h:167
@ enum_Load_Program_Memory_Wait
Definition: P016_26_KG3_TSA.h:178
@ enum_Ready
Ready state.
Definition: P016_26_KG3_TSA.h:162
@ enum_Programming_Enable_Wait
Definition: P016_26_KG3_TSA.h:166
@ enum_Error
Definition: P016_26_KG3_TSA.h:186
@ enum_Write_Program_Memory_Wait
Definition: P016_26_KG3_TSA.h:179
@ enum_Read_Device_Signature_Wait
Definition: P016_26_KG3_TSA.h:170
@ enum_Write_Program_Memory_Done
Definition: P016_26_KG3_TSA.h:180
@ enum_Chip_Erase
Definition: P016_26_KG3_TSA.h:173
@ enum_Read_Device_Signature_Done
Definition: P016_26_KG3_TSA.h:171
@ enum_Load_Program_Memory
Definition: P016_26_KG3_TSA.h:177
@ enum_Programming_Enable
Definition: P016_26_KG3_TSA.h:165
@ enum_Done
Definition: P016_26_KG3_TSA.h:163
@ enum_Chip_Erase_Done
Definition: P016_26_KG3_TSA.h:175
@ enum_Init
Initialisation state.
Definition: P016_26_KG3_TSA.h:161
U32 u32_Delay_Counter
Definition: P016_26_KG3_TSA.h:254
U32 u32_Chip_Erase_Time
Definition: P016_26_KG3_TSA.h:252
TBlock_Output_Connector object_bool_Status
Definition: P016_26_KG3_TSA.h:144
TBlock_Input_Connector object_bool_ISP_Reset
Definition: P016_26_KG3_TSA.h:134
virtual VOID Execute()
Block execution method.
Definition: P016_26_KG3_TSA.cpp:279
U8 u8_Program_Memory_Write_Data[1024]
Definition: P016_26_KG3_TSA.h:260
Definition: Protocol_Base.h:57
U16 u16_ISP_Data_1
0x06 : ISP data 1 register
Definition: P016_26_KG3_TSA.h:99
U16 u16_Unit_ID_H
0x01 : Module identification register
Definition: P016_26_KG3_TSA.h:91
U16 u16_Unit_ID_L
0x00 : Module identification register
Definition: P016_26_KG3_TSA.h:90
U16 u16_ISP_Data_3
0x08 : ISP data 3 register
Definition: P016_26_KG3_TSA.h:101
U16 u16_Unused_0x02
0x02 : Reserved register
Definition: P016_26_KG3_TSA.h:93
U16 u16_ISP_Data_4
0x09 : ISP data 4 register
Definition: P016_26_KG3_TSA.h:102
U16 u16_Unused_0x03
0x03 : Reserved register
Definition: P016_26_KG3_TSA.h:94
U16 u16_Status_Register
0x05 : Control register
Definition: P016_26_KG3_TSA.h:97
U16 u16_ISP_Data_2
0x07 : ISP data 2 register
Definition: P016_26_KG3_TSA.h:100
U16 u16_Control_Register
0x04 : Control register
Definition: P016_26_KG3_TSA.h:96
Definition: P016_26_KG3_TSA.h:222
U16 u16_Control
Definition: P016_26_KG3_TSA.h:223
U16 u16_ISP_Start
Definition: P016_26_KG3_TSA.h:236
U16 u16_ISP_Mode
Definition: P016_26_KG3_TSA.h:235
U16 u16_Clock_Enable
Definition: P016_26_KG3_TSA.h:230
U16 u16_ISP_SCK
Definition: P016_26_KG3_TSA.h:238
U16 u16_LED_Green
Definition: P016_26_KG3_TSA.h:228
U16 u16_LED_Yellow
Definition: P016_26_KG3_TSA.h:227
U16 u16_ISP_Reset
Definition: P016_26_KG3_TSA.h:237
U16 u16_ISP_MOSI
Definition: P016_26_KG3_TSA.h:239
U16 u16_LED_Red
Definition: P016_26_KG3_TSA.h:226
U16 u16_ISP_Enable
Definition: P016_26_KG3_TSA.h:234
Definition: P016_26_KG3_TSA.h:191
U16 u16_ISP_MISO
Definition: P016_26_KG3_TSA.h:214
U16 u16_Status
Definition: P016_26_KG3_TSA.h:193
U16 u16_ISP_Ready
Definition: P016_26_KG3_TSA.h:209
U16 u16_Sensor_LED_Red
Definition: P016_26_KG3_TSA.h:197
U16 u16_Sensor_LED_Green
Definition: P016_26_KG3_TSA.h:198