ConOpSys V2970  P004.07
ANVILEX control operating system
CRC_32_ABCC.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file CRC_32_ABCC.h
3 //! @brief Cyclic reduncancy check (CRC-32-ABCC) class header file.
4 //! @par Algorithm name
5 //! CRC-32-ABCC
6 //! @par Polynom
7 //! ???
8 //! @par Initial value
9 //! 0x00000000
10 //! @par Application
11 //! AnyBus module
12 //! @attention No special attention requered.
13 //! @copyright (C) 2018-2020 ANVILEX LLC
14 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Common/CRC_32_ABCC.h $
15 //! $Revision: 2796 $
16 //! $Date: 2021-07-12 02:57:34 +0500 (Mo, 12 Jul 2021) $
17 //! $Author: minch $
18 //------------------------------------------------------------------------------
19 //
20 // Redistribution and use in source and binary forms, with or without
21 // modification, are permitted provided that the following conditions are met:
22 //
23 // 1. Redistributions of source code must retain the above copyright notice,
24 // this list of conditions and the following disclaimer.
25 //
26 // 2. Redistributions in binary form must reproduce the above copyright notice,
27 // this list of conditions and the following disclaimer in the documentation
28 // and/or other materials provided with the distribution.
29 //
30 // 3. Neither the name of ANVILEX nor the names of its contributors may be
31 // used to endorse or promote products derived from this software without
32 // specific prior written permission.
33 //
34 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
35 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
38 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
39 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
40 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
41 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
42 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
43 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44 // POSSIBILITY OF SUCH DAMAGE.
45 //
46 //------------------------------------------------------------------------------
47 
48 //------------------------------------------------------------------------------
49 // Protecting header files from mutual, recursive inclusion.
50 //------------------------------------------------------------------------------
51 
52 #pragma once
53 
54 //------------------------------------------------------------------------------
55 // Include standard libraries header files
56 //------------------------------------------------------------------------------
57 
58 //------------------------------------------------------------------------------
59 // Include thrid party header files
60 //------------------------------------------------------------------------------
61 
62 //------------------------------------------------------------------------------
63 // Include ConOpSys header files
64 //------------------------------------------------------------------------------
65 
66 #include "CRC_32_Base.h"
67 
68 //------------------------------------------------------------------------------
69 // Include ConOpSys application header files
70 //------------------------------------------------------------------------------
71 
72 //------------------------------------------------------------------------------
73 // Global defines
74 //------------------------------------------------------------------------------
75 
76 //------------------------------------------------------------------------------
77 // Global macros
78 //------------------------------------------------------------------------------
79 
80 //------------------------------------------------------------------------------
81 // Class definitions
82 //------------------------------------------------------------------------------
83 
84 //! @brief Cyclic redundancy check (CRC-32-ABCC) class
85 class TCRC_32_ABCC : public TCRC_32_Base
86 {
87 
88  //----------------------------------------------------------------------------
89  // Public defines, methods and variables
90  //----------------------------------------------------------------------------
91 
92  public:
93 
94  //!-------------------------------------------------------------------------
95  //! @brief Class constructor method
96  //! @note None
97  //! \par Override
98  //! Not allowed
99  //! @attention Don't call this method directly.
100  //! @dotfile TCRC_32_ABCC__TCRC_32_ABCC.dt
101  //--------------------------------------------------------------------------
102 
103  TCRC_32_ABCC();
104 
105  //!-------------------------------------------------------------------------
106  //! @brief Initialise internal CRC value to initial value
107  //! @note None
108  //! \par Override
109  //! Not allowed
110  //! @attention None
111  //! @dotfile TCRC_32_ABCC__Initialise.dt
112  //--------------------------------------------------------------------------
113 
114  VOID Initialise();
115 
116  //!-------------------------------------------------------------------------
117  //! @brief Check CRC of the data buffer
118  //! @note None
119  //! @param [in] *void_Data - Pointer to the data buffer
120  //! @param [in] u32_Size - Size of the data buffer
121  //! @param [in] u32_Expected_CRC - Expected CRC of the data buffer
122  //! @return BOOL - Data buffer CRC checking status
123  //! @retval false - CRC of the buffer not match to expected CRC
124  //! @retval true - CRC of the buffer match to expected CRC
125  //! \par Override
126  //! Not allowed
127  //! @attention None
128  //! @dotfile TCRC_32_ABCC__Check.dt
129  //--------------------------------------------------------------------------
130 
131  BOOL Check( VOID *void_Data, U32 u32_Size, U32 u32_Expected_CRC );
132 
133  //!-------------------------------------------------------------------------
134  //! @brief Calculate CRC of the data buffer
135  //! @note None
136  //! @param [in] *void_Data - Pointer to the data buffer
137  //! @param [in] u32_Size - Size of the data buffer
138  //! @return U8 - Calculated CRC of the data buffer
139  //! \par Override
140  //! Not allowed
141  //! @attention None
142  //! @dotfile TCRC_32_ABCC__Calculate.dt
143  //--------------------------------------------------------------------------
144 
145  virtual U32 Calculate( VOID *void_Data, U32 u32_Size );
146 
147  //!-------------------------------------------------------------------------
148  //! @brief Update CRC with new data value
149  //! @note None
150  //! @param [in, out] &u32_CRC - Actual CRC value
151  //! @param [in] u8_Data - Data value
152  //! @return None
153  //! \par Override
154  //! Not allowed
155  //! @attention None
156  //! @dotfile TCRC_32_ABCC__Update.dt
157  //--------------------------------------------------------------------------
158 
159  virtual VOID Update( U32 &u32_CRC, U8 u8_Data );
160 
161  //!-------------------------------------------------------------------------
162  //! @brief Update internal CRC with new data value
163  //! @note None
164  //! @param [in] u8_Data - Data value
165  //! @return None
166  //! \par Override
167  //! Not allowed
168  //! @attention None
169  //! @dotfile TCRC_32_ABCC__Update.dt
170  //--------------------------------------------------------------------------
171 
172  VOID Update( U8 u8_Data );
173 
174  //----------------------------------------------------------------------------
175  // Protected defines, methods and variables
176  //----------------------------------------------------------------------------
177 
178  protected:
179 
180  //----------------------------------------------------------------------------
181  // Private defines, methods and variables
182  //----------------------------------------------------------------------------
183 
184  private:
185 
186  //! @brief CRC internal storage
188 
189 };
190 
191 //------------------------------------------------------------------------------
192 // End of file
193 //------------------------------------------------------------------------------
Cyclic reduncancy check (CRC-32) base class header file.
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
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
Cyclic redundancy check (CRC-32-ABCC) class.
Definition: CRC_32_ABCC.h:86
VOID Initialise()
Initialise internal CRC value to initial value.
Definition: CRC_32_ABCC.cpp:143
TCRC_32_ABCC()
Class constructor method.
Definition: CRC_32_ABCC.cpp:131
BOOL Check(VOID *void_Data, U32 u32_Size, U32 u32_Expected_CRC)
Check CRC of the data buffer.
Definition: CRC_32_ABCC.cpp:155
virtual U32 Calculate(VOID *void_Data, U32 u32_Size)
Calculate CRC of the data buffer.
Definition: CRC_32_ABCC.cpp:167
virtual VOID Update(U32 &u32_CRC, U8 u8_Data)
Update CRC with new data value.
Definition: CRC_32_ABCC.cpp:191
U32 u32_CRC_Intern
CRC internal storage.
Definition: CRC_32_ABCC.h:187
Cyclic redundancy check (CRC-32) base class.
Definition: CRC_32_Base.h:78