ConOpSys V2970  P004.07
ANVILEX control operating system
ABCC_Base.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file ABCC_Base.h
3 //! @brief ANYBUS module base class 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/Engine/Communication/ABCC/ABCC_Base.h $
7 //! $Revision: 2870 $
8 //! $Date: 2021-09-17 13:49:47 +0500 (Fr, 17 Sep 2021) $
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 ********************************************************************************
42 ** **
43 ** ABCC Starter Kit version 3.04.01 (2018-01-23) **
44 ** **
45 ** Delivered with: **
46 ** ABP 7.55.01 (2017-12-20) **
47 ** ABCC Driver 5.04.01 (2017-12-18) **
48 ** */
49 /*******************************************************************************
50 ********************************************************************************
51 ** COPYRIGHT NOTIFICATION (c) 2013 HMS Industrial Networks AB **
52 ** **
53 ** This code is the property of HMS Industrial Networks AB. **
54 ** The source code may not be reproduced, distributed, or used without **
55 ** permission. When used together with a product from HMS, permission is **
56 ** granted to modify, reproduce and distribute the code in binary form **
57 ** without any restrictions. **
58 ** **
59 ** THE CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. HMS DOES NOT **
60 ** WARRANT THAT THE FUNCTIONS OF THE CODE WILL MEET YOUR REQUIREMENTS, OR **
61 ** THAT THE OPERATION OF THE CODE WILL BE UNINTERRUPTED OR ERROR-FREE, OR **
62 ** THAT DEFECTS IN IT CAN BE CORRECTED. **
63 ********************************************************************************
64 ********************************************************************************
65 ** This is an example implementation of an application handler to control the
66 ** ABCC module. It has support to initialise, run and reset/shutdown the ABCC.
67 ** The state machine shall be executed cyclically and it returns its current
68 ** status after every execution.
69 ********************************************************************************
70 ********************************************************************************
71 **
72 ** Services:
73 **
74 ** APPL_HandleAbcc() - Runs the state machine controlling the ABCC module
75 ** APPL_RestoreToDefault() - Restores any NVS parameter to its default value
76 ** APPL_GetCandidateFwAvailable() - Call to check if there is a firmware in the candidate area
77 ** APPL_SetCandidateFwAvailable() - Sets whether firmware is available in the candidate area
78 ** APPL_IsResetRequestAllowed() - Check if a reset is allowed
79 ** APPL_SetHwSwitch1Value() - Set switch 1 value
80 **
81 ********************************************************************************
82 ********************************************************************************
83 */
84 
85 #pragma once
86 
87 //------------------------------------------------------------------------------
88 
89 #include <string.h>
90 
91 //------------------------------------------------------------------------------
92 
93 #include "abcc_drv_cfg.h"
94 
95 #include "abp.h"
96 #include "abcc.h"
97 
98 //------------------------------------------------------------------------------
99 
100 #include "SPI_Master_Base.h"
101 #include "Protocol_Base.h"
102 #include "Interval_Timer.h"
103 #include "Request_Synchroniser.h"
104 
105 /*------------------------------------------------------------------------------
106 ** Error codes for example application:
107 **
108 ** APPL_NO_ERROR - No error
109 ** APPL_AD_PD_REDA_SIZE_ERR - Total process data read size too large
110 ** Check ABCC_CFG_MAX_PROCESS_DATA_SIZE
111 ** APPL_AD_PD_WRITE_SIZE_ERR - Total process data write too large
112 ** Check ABCC_CFG_MAX_PROCESS_DATA_SIZE
113 ** APPL_AD_TOO_MANY_READ_MAPPINGS - Read process data map has too many entries
114 ** Check AD_MAX_OF_READ_WRITE_TO_MAP.
115 ** APPL_AD_TOO_MANY_WRITE_MAPPINGS- Write process data map has too many entries
116 ** Check AD_MAX_OF_WRITE_WRITE_TO_MAP
117 ** APPL_AD_UNKNOWN_ADI - Requested ADI could not be found
118 **------------------------------------------------------------------------------
119 */
120 
121 typedef enum APPL_ErrCode
122 {
129 }
131 
132 //------------------------------------------------------------------------------
133 /*
134 typedef enum appl_AbccHandlerState
135 {
136  APPL_INIT,
137  APPL_START_DRIVER,
138  APPL_WAITCOM,
139  APPL_SETUP,
140  APPL_RUN,
141  APPL_SHUTDOWN,
142  APPL_ABCCRESET,
143  APPL_DEVRESET,
144  APPL_HALT
145 }
146 appl_AbccHandlerStateType;
147 */
148 //------------------------------------------------------------------------------
149 /*
150 #define NUM_BYTES_2_WORDS( X ) ( ( ( X ) + 1 ) >> 1 )
151 
152 #define SPI_DEFAULT_PD_LEN ( 0 )
153 #define CRC_WORD_LEN_IN_WORDS ( 2 )
154 #define SPI_FRAME_SIZE_EXCLUDING_DATA ( 7 )
155 #define SPI_BASE_FRAME_WORD_LEN ( 5 ) //!< Frame length in words excluding MSG and PD data
156 
157 #if ABCC_CFG_SPI_MSG_FRAG_LEN > ABCC_CFG_MAX_MSG_SIZE
158 #error SPI fragmentation length cannot exceed maximal message size
159 #endif
160 
161 #define MAX_PAYLOAD_WORD_LEN ( ( NUM_BYTES_2_WORDS( ABCC_CFG_SPI_MSG_FRAG_LEN ) ) + ( NUM_BYTES_2_WORDS( ABCC_CFG_MAX_PROCESS_DATA_SIZE ) ) + ( CRC_WORD_LEN_IN_WORDS ) )
162 */
163 //------------------------------------------------------------------------------
164 
165 #define ABCC_MESSAGE_DATA_BUFFER_SIZE ( 16 )
166 //#define ABCC_PROCESS_DATA_BUFFER_SIZE ( 16 )
167 #define ABCC_PROCESS_DATA_BUFFER_SIZE ( 128+64 )
168 
169 // Maximal amount of the mappable process data parameters
170 #define ABCC_MAXIMAL_MAPPABLE_PROCESS_DATA_PARAMETERS ( 128 )
171 
172 //------------------------------------------------------------------------------
173 // Class TABCC
174 //------------------------------------------------------------------------------
175 
177 {
178 
179  //----------------------------------------------------------------------------
180  // Public defines, methods and variables
181  //----------------------------------------------------------------------------
182 
183  public:
184 
185  //!-------------------------------------------------------------------------
186  //! @brief Class constructor method.
187  //! @note None
188  //! \par Override
189  //! Not allowed
190  //! @attention Don't call this method directly.
191  //--------------------------------------------------------------------------
192 
193  TABCC_Base();
194 
195  //!-------------------------------------------------------------------------
196  //! @brief Class destructor method.
197  //! @note None
198  //! \par Override
199  //! Not allowed
200  //! @attention Don't call this method directly.
201  //--------------------------------------------------------------------------
202 
203  virtual ~TABCC_Base();
204 
205  //!-------------------------------------------------------------------------
206  //! @brief ABCC driver initialisation method.
207  //! @note None
208  //! @return None
209  //! \par Override
210  //! Not requered
211  //! @attention None
212  //--------------------------------------------------------------------------
213 
214  VOID Init();
215 
216  //!-------------------------------------------------------------------------
217  //! @brief ABCC driver Finaliseation method.
218  //! @note None
219  //! @return None
220  //! \par Override
221  //! Not requered
222  //! @attention None
223  //--------------------------------------------------------------------------
224 
225  VOID Done();
226 
227  //!-------------------------------------------------------------------------
228  //! @brief Assign SPI master hardware driver.
229  //! @note None
230  //! @param [in] *object_New_SPI_Master - Pointer to the SPI master hardware driver
231  //! @return None
232  //! \par Override
233  //! Not requered
234  //! @attention None
235  //--------------------------------------------------------------------------
236 
237  VOID Assign_SPI_Master( TSPI_Master_Base *object_New_SPI_Master );
238 
239  //!-------------------------------------------------------------------------
240  //! @brief Unassign SPI master hardware driver.
241  //! @note None
242  //! @return None
243  //! \par Override
244  //! Not requered
245  //! @attention None
246  //--------------------------------------------------------------------------
247 
249 
250  //!-------------------------------------------------------------------------
251  //! @brief Activate process data processing.
252  //! @note None
253  //! @return None
254  //! \par Override
255  //! Not requered
256  //! @attention None
257  //--------------------------------------------------------------------------
258 
260 
261  //!-------------------------------------------------------------------------
262  //! @brief Deactivate process data processing.
263  //! @note None
264  //! @return None
265  //! \par Override
266  //! Not requered
267  //! @attention None
268  //--------------------------------------------------------------------------
269 
271 
272  VOID Execute(); //!<
273  VOID Execute_System_Timer(); //!<
274 
275  VOID Map_Write_Parameter_To_Process_Data( TParameter_Base *object_Parameter ); //!< Map parameter to the write process data
276  VOID Map_Read_Parameter_To_Process_Data( TParameter_Base *object_Parameter ); //!!< Map parameter to the read process data
277 
278  BOOL Is_Initialised(); //!< Get initialisation status
279 
280  VOID Send_Information( TProtocol_Base *object_Protocol ); //!< Send information about object
281 
282  //----------------------------------------------------------------------------
283  // Protected defines, methods and variables
284  //----------------------------------------------------------------------------
285 
286  protected:
287 
288  virtual VOID Object_Command( ABP_MsgType* psNewMessage, ABP_MsgType *psResponceMessage ) = 0; //!< Object command processing method
289  virtual VOID Instance_Command( ABP_MsgType* psNewMessage, ABP_MsgType *psResponceMessage ) = 0; //!< Instance command processing method
290 
291  U16 Get_Message_Data_Length( ABP_MsgType *struct_Message );
292  VOID Set_Message_Data_Length( ABP_MsgType *struct_Message, U16 u16_Length );
293 
294  VOID Get_Message_Data_U8( ABP_MsgType* psMsg, U8 *u8_Data, U16 u16_Offset );
295  VOID Set_Message_Data_U8( ABP_MsgType* psMsg, U8 u8_Data, U16 u16_Offset );
296 
297  VOID Get_Message_Data_U16( ABP_MsgType* psMsg, U16 *u16_Data, U16 u16_Offset );
298  VOID Set_Message_Data_U16( ABP_MsgType* psMsg, U16 u16_Data, U16 u16_Offset );
299 
300 // VOID Get_Message_Data_U32( ABP_MsgType* psMsg, U32 *u32_Data, U16 u16_Offset );
301 // VOID Set_Message_Data_U32( ABP_MsgType* psMsg, U32 u32_Data, U16 u16_Offset );
302 
303 // VOID Get_Message_Data_U64( ABP_MsgType* psMsg, U64 *u64_Data, U16 u16_Offset );
304 // VOID Set_Message_Data_U64( ABP_MsgType* psMsg, U64 u64_Data, U16 u16_Offset );
305 
306 // VOID Get_Message_Data_String( ABP_MsgType* psMsg, const char* pcString, U16 iNumChar, U16 u16_Offset );
307  VOID Set_Message_Data_String( ABP_MsgType* psMsg, const char* pcString, U16 iNumChar, U16 u16_Offset );
308 
309  VOID Set_Message_Map_ADI_Area( ABP_MsgType* psMsg, U8 u8_ADI_Data_Type, U8 u8_ADI_Elements_Number, U16 u16_ADI_Order_Number );
310 
311  VOID Set_Msg_Header( ABP_MsgType* psMsg, U8 bObject, U16 iInstance, U8 bAttribute, ABP_MsgCmdType eService, U16 iDataSize, U8 bSourceId );
312  VOID Create_Responce_From_Request( ABP_MsgType* struct_Request_Message, ABP_MsgType* struct_Responce_Message );
313  VOID Create_Error_Responce_From_Request( ABP_MsgType* struct_Request_Message, ABP_MsgType* struct_Responce_Message, ABP_MsgErrorCodeType enum_Error_Code );
314  VOID Set_Message_Responce( ABP_MsgType* psMsg, U16 u16_Data_Size );
315  VOID Set_Message_Error_Response( ABP_MsgType* psMsg, U16 iMsgDataSize, ABP_MsgErrorCodeType eErr );
316 
317  BOOL Is_Message_Command( ABP_MsgType *struct_Message );
318 
319  U16 Get_Message_Instance( ABP_MsgType *struct_Message );
320  U8 Get_Message_Command_Code( ABP_MsgType *struct_Message );
321  U8 Get_Message_Command_Extension_0( ABP_MsgType *struct_Message );
322 
323  VOID Get_Attribute( ABP_MsgType *psMsg, U8 bObject, U16 iInstance, U8 bAttribute, U8 bSourceId );
324  VOID Set_Byte_Attribute( ABP_MsgType *psMsg, U8 bObject, U16 iInstance, U8 bAttribute, U8 bVal, U8 bSourceId );
325 
326  VOID Map_ADI_Write_Area( ABP_MsgType *psMsg, U8 bObject, U16 iInstance, U8 bSourceId, U16 u16_ADI_Instance_Number );
327  VOID Map_ADI_Read_Area( ABP_MsgType *psMsg, U8 bObject, U16 iInstance, U8 bSourceId, U16 u16_ADI_Instance_Number );
328 
329  //----------------------------------------------------------------------------
330  // Private defines, methods and variables
331  //----------------------------------------------------------------------------
332 
333  private:
334 
335  typedef enum
336  {
339  } TABCC_FSM_State;
340 
341  //--------------------------------------------------------------------------
342 
343 // #pragma push
344  #pragma pack(1)
345 
346  typedef struct TSPI_MOSI_Frame
347  {
348 
349  union
350  {
351  struct
352  {
353  U8 bit_Write_Process_Data:1; // Bit 0 - WRPD VALID
354  U8 bit_Command_Count:2; // Bit 1-2 - CMDCNT
355  U8 bit_Message:1; // Bit 3 - M
356  U8 bit_Last_Fragment:1; // Bit 4 - LAST FRAG
357  U8 :1; // Bit 5 - Not used, must be set to 0
358  U8 :1; // Bit 6 - Not used, must be set to 0
359  U8 bit_Toggle:1; // Bit 7 - TOGGLE
362  } u8_SPI_Control_Byte; // Byte 0
363  U8 u8_Reserved; // Byte 1
364  U16 u16_Message_Length; // Byte 2-3
372 
374 
375 // #pragma pop
376  #pragma pack()
377 
378  //--------------------------------------------------------------------------
379 
380 // #pragma push
381  #pragma pack(1)
382 
383  typedef struct TSPI_MISO_Frame
384  {
385 
386  U16 u16_Reserved; // Byte 0-1
387  U16 u16_LED_Status; // Byte 2-3
388  union
389  {
390  struct
391  {
392  U8 bit_State:3; // Bit 0-2 - State
393  U8 bit_Supervised:1; // Bit 3 - Supervised
394  U8 :4; // Bit 4-7 - Not used
397  } u8_AnyBus_Status; // Byte 4
398  union
399  {
400  struct
401  {
402  U8 bit_Message_Buffer_Full:1; // Bit 0 - Message buffer full
403  U8 bit_Command_Count:2; // Bit 1-2 - Command count
404  U8 bit_Message:1; // Bit 3 - Message
405  U8 bit_Last_Fragment:1; // Bit 4 - Last message fragment
406  U8 bit_New_Process_Data:1; // Bit 5 - Process data
407  U8 :1; // Bit 6 - Not used
408  U8 :1; // Bit 7 - Not used
410  U8 u8_Byte;
411  } u8_SPI_Status; // Byte 5
412  U32 u32_NetTime; // Byte 6-9
416 // U32 u32_Calculated_CRC;
418 
419 // #pragma pop
420  #pragma pack()
421 
422  //--------------------------------------------------------------------------
423 
424  typedef struct TABBC_Process_Data
425  {
426 // U16 u16_Length;
429 
430  //--------------------------------------------------------------------------
431 
432  typedef enum TData_Type
433  {
434 
435  enum_BOOL = ABP_BOOL, // Boolean
436  enum_SINT8 = ABP_SINT8, // Signed 8 bit integer
437  enum_SINT16 = ABP_SINT16, // Signed 16 bit integer
438  enum_SINT32 = ABP_SINT32, // Signed 32 bit integer
439  enum_U8 = ABP_U8, // Unsigned 8 bit integer
440  enum_UINT16 = ABP_UINT16, // Unsigned 16 bit integer
441  enum_UINT32 = ABP_UINT32, // Unsigned 32 bit integer
442  enum_CHAR = ABP_CHAR, // Character
443  enum_ENUM = ABP_ENUM, // Enumeration
444  enum_BITS8 = ABP_BITS8, // 8 bit bitfield (ABCC40)
445  enum_BITS16 = ABP_BITS16, // 16 bit bitfield (ABCC40)
446  enum_BITS32 = ABP_BITS32, // 32 bit bitfield (ABCC40)
447  enum_OCTET = ABP_OCTET, // 8 bit data (ABCC40)
448 
449  enum_SINT64 = ABP_SINT64, // Signed 64 bit integer
450  enum_UINT64 = ABP_UINT64, // Unsigned 64 bit integer
451  enum_FLOAT = ABP_FLOAT, // Floating point/real number
452 
453  enum_PAD0 = ABP_PAD0, // Padding bitfield (ABCC40)
454  enum_PAD1 = ABP_PAD1, // Padding bitfield (ABCC40)
455  enum_PAD2 = ABP_PAD2, // Padding bitfield (ABCC40)
456  enum_PAD3 = ABP_PAD3, // Padding bitfield (ABCC40)
457  enum_PAD4 = ABP_PAD4, // Padding bitfield (ABCC40)
458  enum_PAD5 = ABP_PAD5, // Padding bitfield (ABCC40)
459  enum_PAD6 = ABP_PAD6, // Padding bitfield (ABCC40)
460  enum_PAD7 = ABP_PAD7, // Padding bitfield (ABCC40)
461  enum_PAD8 = ABP_PAD8, // Padding bitfield (ABCC40)
462  enum_PAD9 = ABP_PAD9, // Padding bitfield (ABCC40)
463  enum_PAD10 = ABP_PAD10, // Padding bitfield (ABCC40)
464  enum_PAD11 = ABP_PAD11, // Padding bitfield (ABCC40)
465  enum_PAD12 = ABP_PAD12, // Padding bitfield (ABCC40)
466  enum_PAD13 = ABP_PAD13, // Padding bitfield (ABCC40)
467  enum_PAD14 = ABP_PAD14, // Padding bitfield (ABCC40)
468  enum_PAD15 = ABP_PAD15, // Padding bitfield (ABCC40)
469  enum_PAD16 = ABP_PAD16, // Padding bitfield (ABCC40)
470 
471  enum_BOOL1 = ABP_BOOL1, // 1 bit boolean (ABCC40)
472  enum_BIT1 = ABP_BIT1, // 1 bit bitfield (ABCC40)
473  enum_BIT2 = ABP_BIT2, // 2 bit bitfield (ABCC40)
474  enum_BIT3 = ABP_BIT3, // 3 bit bitfield (ABCC40)
475  enum_BIT4 = ABP_BIT4, // 4 bit bitfield (ABCC40)
476  enum_BIT5 = ABP_BIT5, // 5 bit bitfield (ABCC40)
477  enum_BIT6 = ABP_BIT6, // 6 bit bitfield (ABCC40)
478  enum_BIT7 = ABP_BIT7, // 7 bit bitfield (ABCC40)
479 
480  enum_Unsupported = 255 // Unsupported data type
481 
483 
485  {
486  TParameter_Base *object_Parameter; //!< Pointer to the parameter
487  U16 u16_Offset; //!< Offset within process data buffer
488  TRIL tril_Mapped; //!< Parameter mapped status flag
490 
492 
493  VOID Activate_Hardware_Reset(); //!< Activate hardware reset
494  VOID Deactivate_Hardware_Reset(); //!< Deactivate hardware reset
495 
499 
507 // VOID Prepare_Process_Data_Mapping();
513 
514  VOID Get_Exception_Command(); //!< Get exception command
516 
519  VOID RX_Message_Processed(); //!< RX message processed notification
520 
521  BOOL Is_New_Read_Process_Data_Present(); //!< Return new read process data status
524 
525  BOOL Network_Setup(); //!< Network setup method
526 
529  BOOL Get_Parameter_Data_Type_Properties( TParameter_Base *object_Parameter, TABCC_Base::TData_Type *enum_Data_Type, U8 *u8_Data_Type_Size );
530 
532 
534 
535  U32 CRC32_ABCC( U8* pbBufferStart, U16 iLength );
536 
537  //--------------------------------------------------------------------------
538  // Private variables
539  //--------------------------------------------------------------------------
540 
541  //! @brief Pointer to the SPI master object
543 
544  //!< Initialisation error flag
546 
547  //!< ABCC module detection status flag
549 
550  //!< ABCC module reset status flag
552 
553  //!< ABCC module startup status flag
555 
556  //!< ABCC module setup status flag
558 
559  //!< ABCC network setup status flag
561 
562  //!< Module reset acceptance time
564 
565  //!< Module startup time
567 
568  //!< Module startup timeout
570 
571  // ABCC finiti state machine
573 
574  //!< APB message to the module
575  ABP_MsgType struct_MOSI_Message;
576 
577  //!< APB message from the module
578  ABP_MsgType struct_MISO_Message;
579 
580  //!< MOSI message frame buffer
582 
583  //!< MISO message frame buffer
585 
586  //!< Write process data structure
588 
589  //!< Read process data structure
591 
592  //!< Write proceess data parameter buffer index
594 
595  //!< Read proceess data parameter buffer index
597 
598  //!< Process data write parameter buffer
600 
601  //!< Process data read parameter buffer
603 
604  //!< First transfer after module reset flag
606 
607  //!< Toggle bit status flag
609 
610  //!< Retransmit requered flag
612 
613  //!< New transmit message present flag
615 // BOOL bool_New_TX_Process_Data_Present;
616 
617  //!< New receive message present flag
619 
620  //!< Nre receive process data present flag
622 
623  //!< Frame CRC error counter
625 
626  //!< ABCC module error responce counter
628 
629  //!< ABCC module request counter
631 
633 
634  //!< Network data format
635  NetFormatType enum_Net_Data_Format;
636 
637  //!< Parameter support flag
638  ParameterSupportType enum_Parameter_Support;
639 
640  //!< ABCC module type
642 
643  //!< ABCC network type
645 
646  //!< ABCC firmware major version
648 
649  //!< ABCC firmware minor version
651 
652  //!< ABCC module firmware version build
654 
655  //!< Process data read size
657 
658  //!< Process data write size
660 
661  //!< Exception code
663 
664  //!< Exception info code
666 
667  //!< ABCC module LED status
669 
670  //!< ABCC module state
671  ABP_AnbStateType enum_ABCC_State;
672 
673  //!< Process data mapping error flag
675 
676  //!< Message data buffer overflow flag
678 
679  //!< Interval timer object for triggering write process data update
681 
682  //!< Write process data request flag
684 
685 /*
686 00h No exception -
687 01h Application timeout The host application has not responded within the specified watchdog timeout period.
688 02h Invalid device address The selected device address is not valid for the actual network.
689 03h Invalid communication settings The selected communication settings are not valid for the actual network.
690 04h Major unrecoverable app event The host application has reported a major unrecoverable event to the Diagnostic object.
691 05h Wait for reset The module is waiting for the host application to execute a reset.
692 06h Invalid process data config The Process Data configuration is invalid.
693 07h Invalid application response The host application has provided an invalid response to a command.
694 08h Nonvolatile memory checksum error At least one of the parameters stored in nonvolatile memory has been restored to its default value due to a checksum error.
695 09h ASM communication error Communication is lost between the Anybus CompactCom module and the attached Anybus safety module.
696 0Ah Insufficient application implementation The application does not implement the functionality required for the Anybus module to continue its operation.
697 0Bh Missing serial number The module is missing a serial number. This might happen in product configurations which does not have an embedded serial number (e.g. Anybus IP), and the application fails to supply one.
698 0Ch Corrupt file system The file system is corrupt and must be formatted by user.
699 */
700 };
701 
702 //------------------------------------------------------------------------------
703 // End Of File
704 //------------------------------------------------------------------------------
#define ABCC_PROCESS_DATA_BUFFER_SIZE
Definition: ABCC_Base.h:167
APPL_ErrCode
Definition: ABCC_Base.h:122
@ APPL_AD_TOO_MANY_WRITE_MAPPINGS
Definition: ABCC_Base.h:127
@ APPL_NO_ERROR
Definition: ABCC_Base.h:123
@ APPL_AD_UNKNOWN_ADI
Definition: ABCC_Base.h:128
@ APPL_AD_PD_READ_SIZE_ERR
Definition: ABCC_Base.h:124
@ APPL_AD_PD_WRITE_SIZE_ERR
Definition: ABCC_Base.h:125
@ APPL_AD_TOO_MANY_READ_MAPPINGS
Definition: ABCC_Base.h:126
enum APPL_ErrCode APPL_ErrCodeType
#define ABCC_MESSAGE_DATA_BUFFER_SIZE
Definition: ABCC_Base.h:165
#define ABCC_MAXIMAL_MAPPABLE_PROCESS_DATA_PARAMETERS
Definition: ABCC_Base.h:170
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
int TRIL
Thrilean datatype defenition.
Definition: Defines.h:143
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
Interval timer class header file.
Communication protocol base class header file.
SPI bus master base class header file.
Definition: ABCC_Base.h:177
TABBC_Process_Data struct_RX_Process_Data
Write proceess data parameter buffer index.
Definition: ABCC_Base.h:590
TProcess_Data_Parameter_Record struct_Write_Process_Data_Parameter_Buffer[ABCC_MAXIMAL_MAPPABLE_PROCESS_DATA_PARAMETERS]
Process data read parameter buffer.
Definition: ABCC_Base.h:599
U32 u32_ABCC_Error_Responce_Counter
ABCC module request counter.
Definition: ABCC_Base.h:627
VOID Init()
ABCC driver initialisation method.
Definition: ABCC_Base.cpp:398
VOID Set_Message_Data_U8(ABP_MsgType *psMsg, U8 u8_Data, U16 u16_Offset)
Definition: ABCC_Base.cpp:3801
VOID Bus_Transaction()
Definition: ABCC_Base.cpp:2407
VOID Get_Message_Data_U16(ABP_MsgType *psMsg, U16 *u16_Data, U16 u16_Offset)
Definition: ABCC_Base.cpp:3811
VOID New_Read_Process_Data_Processed()
Definition: ABCC_Base.cpp:3454
VOID Get_Module_Type_Command()
Definition: ABCC_Base.cpp:4184
VOID Get_Data_Format_Command()
Definition: ABCC_Base.cpp:3940
U32 u32_Frame_CRC_Error_Counter
ABCC module error responce counter.
Definition: ABCC_Base.h:624
VOID Activate_Hardware_Reset()
Activate hardware reset.
Definition: ABCC_Base.cpp:3361
TABCC_Base::TData_Type Get_Parameter_Data_Type(TParameter_Base *object_Parameter)
Definition: ABCC_Base.cpp:1507
TSPI_MOSI_Frame struct_MOSI_Buffer
MISO message frame buffer.
Definition: ABCC_Base.h:581
VOID Set_Byte_Attribute(ABP_MsgType *psMsg, U8 bObject, U16 iInstance, U8 bAttribute, U8 bVal, U8 bSourceId)
Definition: ABCC_Base.cpp:3690
ParameterSupportType enum_Parameter_Support
ABCC module type.
Definition: ABCC_Base.h:638
virtual VOID Object_Command(ABP_MsgType *psNewMessage, ABP_MsgType *psResponceMessage)=0
Object command processing method.
BOOL bool_First_Transfer_After_Reset
Toggle bit status flag.
Definition: ABCC_Base.h:605
VOID Assign_SPI_Master(TSPI_Master_Base *object_New_SPI_Master)
Assign SPI master hardware driver.
Definition: ABCC_Base.cpp:1017
U16 u16_ABCC_LED_Status
ABCC module state.
Definition: ABCC_Base.h:668
VOID Write_Process_Data_Size_Command()
Definition: ABCC_Base.cpp:4889
TRIL tril_ABCC_Module_Setup_Status
ABCC network setup status flag.
Definition: ABCC_Base.h:557
struct TABCC_Base::TABBC_Process_Data TABBC_Process_Data
U32 u32_Module_Reset_Acceptance_Time
Module startup time.
Definition: ABCC_Base.h:563
VOID Get_Firmware_Version_Command()
Definition: ABCC_Base.cpp:4336
VOID Dummy_Command()
Definition: ABCC_Base.cpp:3879
TRIL tril_ABCC_Module_Startup_Status
ABCC module setup status flag.
Definition: ABCC_Base.h:554
struct TABCC_Base::TSPI_MISO_Frame TSPI_MISO_Frame
BOOL bool_Toggle_Bit_Status
Retransmit requered flag.
Definition: ABCC_Base.h:608
TRIL tril_ABCC_Module_Detection_Status
ABCC module reset status flag.
Definition: ABCC_Base.h:548
struct TABCC_Base::TSPI_MOSI_Frame TSPI_MOSI_Frame
VOID Map_Read_Parameter_To_Process_Data(TParameter_Base *object_Parameter)
Definition: ABCC_Base.cpp:1177
VOID Set_Message_Map_ADI_Area(ABP_MsgType *psMsg, U8 u8_ADI_Data_Type, U8 u8_ADI_Elements_Number, U16 u16_ADI_Order_Number)
Definition: ABCC_Base.cpp:3866
BOOL bool_Retransmit_Requered
New transmit message present flag.
Definition: ABCC_Base.h:611
NetFormatType enum_Net_Data_Format
Parameter support flag.
Definition: ABCC_Base.h:635
ABP_MsgType struct_MISO_Message
MOSI message frame buffer.
Definition: ABCC_Base.h:578
TABBC_Process_Data struct_TX_Process_Data
Read process data structure.
Definition: ABCC_Base.h:587
U16 Get_Message_Instance(ABP_MsgType *struct_Message)
Definition: ABCC_Base.cpp:3616
TABCC_FSM_State fsm_ABCC
APB message to the module.
Definition: ABCC_Base.h:572
U32 CRC32_ABCC(U8 *pbBufferStart, U16 iLength)
Definition: ABCC_Base.cpp:2923
VOID Done()
ABCC driver Finaliseation method.
Definition: ABCC_Base.cpp:1005
U8 u8_ABCC_Firmware_Version_Major
ABCC firmware minor version.
Definition: ABCC_Base.h:647
BOOL Is_New_Firmware_Avaliable()
Definition: ABCC_Base.cpp:3383
VOID Map_Write_Parameter_To_Process_Data(TParameter_Base *object_Parameter)
Map parameter to the write process data.
Definition: ABCC_Base.cpp:1118
ABP_AnbStateType enum_ABCC_State
Process data mapping error flag.
Definition: ABCC_Base.h:671
BOOL Network_Setup()
Network setup method.
Definition: ABCC_Base.cpp:1396
VOID Set_Message_Error_Response(ABP_MsgType *psMsg, U16 iMsgDataSize, ABP_MsgErrorCodeType eErr)
Definition: ABCC_Base.cpp:3584
VOID Map_ADI_Read_Area_Command()
Definition: ABCC_Base.cpp:4643
VOID Get_Attribute(ABP_MsgType *psMsg, U8 bObject, U16 iInstance, U8 bAttribute, U8 bSourceId)
Definition: ABCC_Base.cpp:3648
VOID Process_New_RX_Message()
Definition: ABCC_Base.cpp:2969
VOID Set_Msg_Header(ABP_MsgType *psMsg, U8 bObject, U16 iInstance, U8 bAttribute, ABP_MsgCmdType eService, U16 iDataSize, U8 bSourceId)
Definition: ABCC_Base.cpp:3492
U32 u32_Write_Process_Data_Parameter_Buffer_Index
Read proceess data parameter buffer index.
Definition: ABCC_Base.h:593
VOID Execute()
Definition: ABCC_Base.cpp:1061
BOOL Is_Message_Command(ABP_MsgType *struct_Message)
Definition: ABCC_Base.cpp:3606
BOOL Is_Interrupt_Line_Active()
Definition: ABCC_Base.cpp:3406
VOID Setup_Complete_Command()
Definition: ABCC_Base.cpp:4986
U16 Get_Message_Data_Length(ABP_MsgType *struct_Message)
Definition: ABCC_Base.cpp:3771
U32 u32_Read_Process_Data_Parameter_Buffer_Index
Process data write parameter buffer.
Definition: ABCC_Base.h:596
TData_Type
Definition: ABCC_Base.h:433
@ enum_SINT16
Definition: ABCC_Base.h:437
@ enum_U8
Definition: ABCC_Base.h:439
@ enum_UINT32
Definition: ABCC_Base.h:441
@ enum_BIT4
Definition: ABCC_Base.h:475
@ enum_FLOAT
Definition: ABCC_Base.h:451
@ enum_UINT16
Definition: ABCC_Base.h:440
@ enum_CHAR
Definition: ABCC_Base.h:442
@ enum_UINT64
Definition: ABCC_Base.h:450
@ enum_PAD15
Definition: ABCC_Base.h:468
@ enum_PAD2
Definition: ABCC_Base.h:455
@ enum_SINT8
Definition: ABCC_Base.h:436
@ enum_BIT2
Definition: ABCC_Base.h:473
@ enum_PAD11
Definition: ABCC_Base.h:464
@ enum_BIT6
Definition: ABCC_Base.h:477
@ enum_OCTET
Definition: ABCC_Base.h:447
@ enum_BITS16
Definition: ABCC_Base.h:445
@ enum_PAD13
Definition: ABCC_Base.h:466
@ enum_BIT3
Definition: ABCC_Base.h:474
@ enum_BITS32
Definition: ABCC_Base.h:446
@ enum_PAD8
Definition: ABCC_Base.h:461
@ enum_BOOL1
Definition: ABCC_Base.h:471
@ enum_PAD12
Definition: ABCC_Base.h:465
@ enum_Unsupported
Definition: ABCC_Base.h:480
@ enum_SINT32
Definition: ABCC_Base.h:438
@ enum_BITS8
Definition: ABCC_Base.h:444
@ enum_PAD4
Definition: ABCC_Base.h:457
@ enum_PAD7
Definition: ABCC_Base.h:460
@ enum_BIT7
Definition: ABCC_Base.h:478
@ enum_PAD1
Definition: ABCC_Base.h:454
@ enum_BIT1
Definition: ABCC_Base.h:472
@ enum_ENUM
Definition: ABCC_Base.h:443
@ enum_PAD10
Definition: ABCC_Base.h:463
@ enum_PAD6
Definition: ABCC_Base.h:459
@ enum_PAD3
Definition: ABCC_Base.h:456
@ enum_PAD5
Definition: ABCC_Base.h:458
@ enum_BIT5
Definition: ABCC_Base.h:476
@ enum_SINT64
Definition: ABCC_Base.h:449
@ enum_PAD16
Definition: ABCC_Base.h:469
@ enum_PAD0
Definition: ABCC_Base.h:453
@ enum_BOOL
Definition: ABCC_Base.h:435
@ enum_PAD14
Definition: ABCC_Base.h:467
@ enum_PAD9
Definition: ABCC_Base.h:462
VOID Set_Message_Responce(ABP_MsgType *psMsg, U16 u16_Data_Size)
Definition: ABCC_Base.cpp:3566
VOID Get_Exception_Info_Command()
Definition: ABCC_Base.cpp:5165
BOOL Module_Detect()
Definition: ABCC_Base.cpp:3351
VOID Read_Process_Data_Size_Command()
Definition: ABCC_Base.cpp:4791
struct TABCC_Base::TProcess_Data_Parameter_Record TProcess_Data_Parameter_Record
U8 Get_Message_Command_Extension_0(ABP_MsgType *struct_Message)
Definition: ABCC_Base.cpp:3636
BOOL Get_Parameter_Data_Type_Properties(TParameter_Base *object_Parameter, TABCC_Base::TData_Type *enum_Data_Type, U8 *u8_Data_Type_Size)
Definition: ABCC_Base.cpp:2308
TRequest_Synchroniser object_Write_Process_Data_Request
Definition: ABCC_Base.h:683
U8 Get_Message_Command_Code(ABP_MsgType *struct_Message)
Definition: ABCC_Base.cpp:3626
TRIL tril_ABCC_Network_Setup_Status
Module reset acceptance time.
Definition: ABCC_Base.h:560
VOID Create_Responce_From_Request(ABP_MsgType *struct_Request_Message, ABP_MsgType *struct_Responce_Message)
Definition: ABCC_Base.cpp:3523
U8 u8_ABCC_Firmware_Version_Build
Process data read size.
Definition: ABCC_Base.h:653
VOID Set_Message_Data_Length(ABP_MsgType *struct_Message, U16 u16_Length)
Definition: ABCC_Base.cpp:3781
VOID Map_ADI_Write_Area(ABP_MsgType *psMsg, U8 bObject, U16 iInstance, U8 bSourceId, U16 u16_ADI_Instance_Number)
Definition: ABCC_Base.cpp:3733
BOOL bool_Process_Data_Mapping_Error
Message data buffer overflow flag.
Definition: ABCC_Base.h:674
U16 Get_Requered_Process_Data_Buffer_Size()
Definition: ABCC_Base.cpp:2397
virtual VOID Instance_Command(ABP_MsgType *psNewMessage, ABP_MsgType *psResponceMessage)=0
Instance command processing method.
TABCC_FSM_State
Definition: ABCC_Base.h:336
@ enum_ABCC_Transfer_Frame
Definition: ABCC_Base.h:337
@ enum_ABCC_Error
Definition: ABCC_Base.h:338
U8 u8_Exception_Code
Exception info code.
Definition: ABCC_Base.h:662
U32 u32_Module_Startup_Time
Module startup timeout.
Definition: ABCC_Base.h:566
BOOL Is_Initialised()
!< Map parameter to the read process data
Definition: ABCC_Base.cpp:1238
VOID Map_ADI_Read_Area(ABP_MsgType *psMsg, U8 bObject, U16 iInstance, U8 bSourceId, U16 u16_ADI_Instance_Number)
Definition: ABCC_Base.cpp:3752
U16 u16_Write_Process_Data_Size
Exception code.
Definition: ABCC_Base.h:659
BOOL Is_New_Read_Process_Data_Present()
Return new read process data status.
Definition: ABCC_Base.cpp:5264
VOID Deactivate_Process_Data()
Deactivate process data processing.
Definition: ABCC_Base.cpp:1049
VOID Get_Message_Data_U8(ABP_MsgType *psMsg, U8 *u8_Data, U16 u16_Offset)
Definition: ABCC_Base.cpp:3791
VOID Process_Read_Process_Data()
Definition: ABCC_Base.cpp:3470
BOOL bool_New_TX_Message_Present
Definition: ABCC_Base.h:614
U16 u16_Read_Process_Data_Size
Process data write size.
Definition: ABCC_Base.h:656
TSPI_MISO_Frame struct_MISO_Buffer
Write process data structure.
Definition: ABCC_Base.h:584
TSPI_Master_Base * object_SPI_Master
Pointer to the SPI master object.
Definition: ABCC_Base.h:542
virtual ~TABCC_Base()
Class destructor method.
Definition: ABCC_Base.cpp:390
VOID Set_Message_Data_U16(ABP_MsgType *psMsg, U16 u16_Data, U16 u16_Offset)
Definition: ABCC_Base.cpp:3821
VOID Execute_System_Timer()
Definition: ABCC_Base.cpp:1098
BOOL Is_New_RX_Message_Present()
Definition: ABCC_Base.cpp:3444
TInterval_Timer object_Write_Process_Data_Timer
Write process data request flag.
Definition: ABCC_Base.h:680
VOID Activate_Process_Data()
Activate process data processing.
Definition: ABCC_Base.cpp:1039
VOID Create_Error_Responce_From_Request(ABP_MsgType *struct_Request_Message, ABP_MsgType *struct_Responce_Message, ABP_MsgErrorCodeType enum_Error_Code)
Definition: ABCC_Base.cpp:3543
VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about object.
Definition: ABCC_Base.cpp:1248
U32 u32_Startup_Timeout
Definition: ABCC_Base.h:569
BOOL bool_New_RX_Message_Present
< New receive message present flag
Definition: ABCC_Base.h:618
TRIL tril_ABCC_Module_Reset_Status
ABCC module startup status flag.
Definition: ABCC_Base.h:551
BOOL bool_Initialisation_Error
ABCC module detection status flag.
Definition: ABCC_Base.h:545
U16 u16_ABCC_Network_Type
ABCC firmware major version.
Definition: ABCC_Base.h:644
VOID Get_Exception_Command()
Get exception command.
Definition: ABCC_Base.cpp:5066
VOID Set_Node_Address()
Definition: ABCC_Base.cpp:4411
TABCC_Base()
Class constructor method.
Definition: ABCC_Base.cpp:300
VOID RX_Message_Processed()
RX message processed notification.
Definition: ABCC_Base.cpp:5274
VOID Map_ADI_Write_Area_Command()
Definition: ABCC_Base.cpp:4491
VOID Unassign_SPI_Master()
Unassign SPI master hardware driver.
Definition: ABCC_Base.cpp:1029
U8 u8_Exception_Info_Code
ABCC module LED status.
Definition: ABCC_Base.h:665
U16 u16_ABCC_Module_Type
ABCC network type.
Definition: ABCC_Base.h:641
BOOL bool_Message_Data_Buffer_Overflow
Interval timer object for triggering write process data update.
Definition: ABCC_Base.h:677
VOID Get_Network_Type_Command()
Definition: ABCC_Base.cpp:4260
ABP_MsgType struct_MOSI_Message
APB message from the module.
Definition: ABCC_Base.h:575
BOOL bool_New_RX_Process_Data_Present
Frame CRC error counter.
Definition: ABCC_Base.h:621
U8 u8_ABCC_Firmware_Version_Minor
ABCC module firmware version build.
Definition: ABCC_Base.h:650
U32 u32_Test_CRC
Network data format.
Definition: ABCC_Base.h:632
VOID Deactivate_Hardware_Reset()
Deactivate hardware reset.
Definition: ABCC_Base.cpp:3372
U32 u32_ABCC_Request_Counter
Definition: ABCC_Base.h:630
U8 Get_Data_Type_Size_In_Bytes(TABCC_Base::TData_Type enum_Data_Type)
Definition: ABCC_Base.cpp:2186
VOID Get_Parameter_Support_Command()
Definition: ABCC_Base.cpp:4062
BOOL Is_Hardware_Reset_State()
Definition: ABCC_Base.cpp:3393
VOID Set_Message_Data_String(ABP_MsgType *psMsg, const char *pcString, U16 iNumChar, U16 u16_Offset)
Definition: ABCC_Base.cpp:3832
TProcess_Data_Parameter_Record struct_Read_Process_Data_Parameter_Buffer[ABCC_MAXIMAL_MAPPABLE_PROCESS_DATA_PARAMETERS]
First transfer after module reset flag.
Definition: ABCC_Base.h:602
Interval timer clase.
Definition: Interval_Timer.h:52
Parameter base class.
Definition: Parameter_Base.h:60
Definition: Protocol_Base.h:57
Definition: Request_Synchroniser.h:17
SPI master base class.
Definition: SPI_Master_Base.h:58
Definition: ABCC_Base.h:425
U8 u8_Data[ABCC_PROCESS_DATA_BUFFER_SIZE]
Definition: ABCC_Base.h:427
U16 u16_Offset
Offset within process data buffer.
Definition: ABCC_Base.h:487
TRIL tril_Mapped
Parameter mapped status flag.
Definition: ABCC_Base.h:488
TParameter_Base * object_Parameter
Pointer to the parameter.
Definition: ABCC_Base.h:486
Definition: ABCC_Base.h:384
U8 bit_State
Definition: ABCC_Base.h:392
U8 u8_Process_Data[ABCC_PROCESS_DATA_BUFFER_SIZE]
Definition: ABCC_Base.h:414
U8 bit_Message
Definition: ABCC_Base.h:404
U8 bit_Command_Count
Definition: ABCC_Base.h:403
U8 u8_Byte
Definition: ABCC_Base.h:396
struct TABCC_Base::TSPI_MISO_Frame::@69::@71 u8_Bits
U8 bit_Last_Fragment
Definition: ABCC_Base.h:405
U8 bit_New_Process_Data
Definition: ABCC_Base.h:406
U16 u16_Reserved
Definition: ABCC_Base.h:386
union TABCC_Base::TSPI_MISO_Frame::@70 u8_SPI_Status
U8 bit_Supervised
Definition: ABCC_Base.h:393
U16 u16_LED_Status
Definition: ABCC_Base.h:387
U32 u32_NetTime
Definition: ABCC_Base.h:412
U8 u8_Message_Data[ABCC_MESSAGE_DATA_BUFFER_SIZE]
Definition: ABCC_Base.h:413
union TABCC_Base::TSPI_MISO_Frame::@69 u8_AnyBus_Status
U8 bit_Message_Buffer_Full
Definition: ABCC_Base.h:402
U32 u32_CRC
Definition: ABCC_Base.h:415
Definition: ABCC_Base.h:347
U8 bit_Last_Fragment
Definition: ABCC_Base.h:356
struct TABCC_Base::TSPI_MOSI_Frame::@67::@68 u8_Bits
U8 bit_Command_Count
Definition: ABCC_Base.h:354
U16 u16_Process_Data_Length
Definition: ABCC_Base.h:365
U8 bit_Toggle
Definition: ABCC_Base.h:359
U16 u16_Message_Length
Definition: ABCC_Base.h:364
union TABCC_Base::TSPI_MOSI_Frame::@67 u8_SPI_Control_Byte
U8 u8_Message_Data[ABCC_MESSAGE_DATA_BUFFER_SIZE]
Definition: ABCC_Base.h:368
U8 u8_Byte
Definition: ABCC_Base.h:361
U8 bit_Message
Definition: ABCC_Base.h:355
U8 bit_Write_Process_Data
Definition: ABCC_Base.h:353
U8 u8_Process_Data[ABCC_PROCESS_DATA_BUFFER_SIZE]
Definition: ABCC_Base.h:369
U16 u16_Dummy
Definition: ABCC_Base.h:371
U8 u8_Reserved
Definition: ABCC_Base.h:363
U8 u8_Application_Status
Definition: ABCC_Base.h:366
U8 u8_Interrupt_Mask
Definition: ABCC_Base.h:367
U32 u32_CRC
Definition: ABCC_Base.h:370