RFAL library for the STMicroelectronics X-NUCLEO-NFC05A1
rfal_crc.h@0:75fc82583a41, 2019-11-14 (annotated)
- Committer:
- DiegoOstuni
- Date:
- Thu Nov 14 14:34:50 2019 +0000
- Revision:
- 0:75fc82583a41
Add files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DiegoOstuni | 0:75fc82583a41 | 1 | |
DiegoOstuni | 0:75fc82583a41 | 2 | /****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 3 | * @attention |
DiegoOstuni | 0:75fc82583a41 | 4 | * |
DiegoOstuni | 0:75fc82583a41 | 5 | * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2> |
DiegoOstuni | 0:75fc82583a41 | 6 | * |
DiegoOstuni | 0:75fc82583a41 | 7 | * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License"); |
DiegoOstuni | 0:75fc82583a41 | 8 | * You may not use this file except in compliance with the License. |
DiegoOstuni | 0:75fc82583a41 | 9 | * You may obtain a copy of the License at: |
DiegoOstuni | 0:75fc82583a41 | 10 | * |
DiegoOstuni | 0:75fc82583a41 | 11 | * http://www.st.com/myliberty |
DiegoOstuni | 0:75fc82583a41 | 12 | * |
DiegoOstuni | 0:75fc82583a41 | 13 | * Unless required by applicable law or agreed to in writing, software |
DiegoOstuni | 0:75fc82583a41 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
DiegoOstuni | 0:75fc82583a41 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, |
DiegoOstuni | 0:75fc82583a41 | 16 | * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY, |
DiegoOstuni | 0:75fc82583a41 | 17 | * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. |
DiegoOstuni | 0:75fc82583a41 | 18 | * See the License for the specific language governing permissions and |
DiegoOstuni | 0:75fc82583a41 | 19 | * limitations under the License. |
DiegoOstuni | 0:75fc82583a41 | 20 | * |
DiegoOstuni | 0:75fc82583a41 | 21 | ******************************************************************************/ |
DiegoOstuni | 0:75fc82583a41 | 22 | |
DiegoOstuni | 0:75fc82583a41 | 23 | /* |
DiegoOstuni | 0:75fc82583a41 | 24 | * PROJECT: ST25R391x firmware |
DiegoOstuni | 0:75fc82583a41 | 25 | * $Revision: $ |
DiegoOstuni | 0:75fc82583a41 | 26 | * LANGUAGE: ISO C99 |
DiegoOstuni | 0:75fc82583a41 | 27 | */ |
DiegoOstuni | 0:75fc82583a41 | 28 | |
DiegoOstuni | 0:75fc82583a41 | 29 | /*! \file rfal_crc.h |
DiegoOstuni | 0:75fc82583a41 | 30 | * |
DiegoOstuni | 0:75fc82583a41 | 31 | * \author Ulrich Herrmann |
DiegoOstuni | 0:75fc82583a41 | 32 | * |
DiegoOstuni | 0:75fc82583a41 | 33 | * \brief CRC calculation module |
DiegoOstuni | 0:75fc82583a41 | 34 | * |
DiegoOstuni | 0:75fc82583a41 | 35 | */ |
DiegoOstuni | 0:75fc82583a41 | 36 | /*! |
DiegoOstuni | 0:75fc82583a41 | 37 | * |
DiegoOstuni | 0:75fc82583a41 | 38 | */ |
DiegoOstuni | 0:75fc82583a41 | 39 | |
DiegoOstuni | 0:75fc82583a41 | 40 | #ifndef RFAL_CRC_H_ |
DiegoOstuni | 0:75fc82583a41 | 41 | #define RFAL_CRC_H_ |
DiegoOstuni | 0:75fc82583a41 | 42 | |
DiegoOstuni | 0:75fc82583a41 | 43 | /* |
DiegoOstuni | 0:75fc82583a41 | 44 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 45 | * INCLUDES |
DiegoOstuni | 0:75fc82583a41 | 46 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 47 | */ |
DiegoOstuni | 0:75fc82583a41 | 48 | #include "platform1.h" |
DiegoOstuni | 0:75fc82583a41 | 49 | |
DiegoOstuni | 0:75fc82583a41 | 50 | /* |
DiegoOstuni | 0:75fc82583a41 | 51 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 52 | * GLOBAL FUNCTION PROTOTYPES |
DiegoOstuni | 0:75fc82583a41 | 53 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 54 | */ |
DiegoOstuni | 0:75fc82583a41 | 55 | /*! |
DiegoOstuni | 0:75fc82583a41 | 56 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 57 | * \brief Calculate CRC according to CCITT standard. |
DiegoOstuni | 0:75fc82583a41 | 58 | * |
DiegoOstuni | 0:75fc82583a41 | 59 | * This function takes \a length bytes from \a buf and calculates the CRC |
DiegoOstuni | 0:75fc82583a41 | 60 | * for this data. The result is returned. |
DiegoOstuni | 0:75fc82583a41 | 61 | * \note This implementation calculates the CRC with LSB first, i.e. all |
DiegoOstuni | 0:75fc82583a41 | 62 | * bytes are "read" from right to left. |
DiegoOstuni | 0:75fc82583a41 | 63 | * |
DiegoOstuni | 0:75fc82583a41 | 64 | * \param[in] preloadValue : Initial value of CRC calculation. |
DiegoOstuni | 0:75fc82583a41 | 65 | * \param[in] buf : buffer to calculate the CRC for. |
DiegoOstuni | 0:75fc82583a41 | 66 | * \param[in] length : size of the buffer. |
DiegoOstuni | 0:75fc82583a41 | 67 | * |
DiegoOstuni | 0:75fc82583a41 | 68 | * \return 16 bit long crc value. |
DiegoOstuni | 0:75fc82583a41 | 69 | * |
DiegoOstuni | 0:75fc82583a41 | 70 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 71 | */ |
DiegoOstuni | 0:75fc82583a41 | 72 | extern uint16_t rfalCrcCalculateCcitt(uint16_t preloadValue, const uint8_t* buf, uint16_t length); |
DiegoOstuni | 0:75fc82583a41 | 73 | |
DiegoOstuni | 0:75fc82583a41 | 74 | #endif /* RFAL_CRC_H_ */ |
DiegoOstuni | 0:75fc82583a41 | 75 |