mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
180:96ed750bd169
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 156:95d6b41a828b 1 /**
<> 156:95d6b41a828b 2 ******************************************************************************
<> 156:95d6b41a828b 3 * @file stm32f0xx_ll_crc.c
<> 156:95d6b41a828b 4 * @author MCD Application Team
<> 156:95d6b41a828b 5 * @brief CRC LL module driver.
<> 156:95d6b41a828b 6 ******************************************************************************
<> 156:95d6b41a828b 7 * @attention
<> 156:95d6b41a828b 8 *
<> 156:95d6b41a828b 9 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
<> 156:95d6b41a828b 10 *
<> 156:95d6b41a828b 11 * Redistribution and use in source and binary forms, with or without modification,
<> 156:95d6b41a828b 12 * are permitted provided that the following conditions are met:
<> 156:95d6b41a828b 13 * 1. Redistributions of source code must retain the above copyright notice,
<> 156:95d6b41a828b 14 * this list of conditions and the following disclaimer.
<> 156:95d6b41a828b 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 156:95d6b41a828b 16 * this list of conditions and the following disclaimer in the documentation
<> 156:95d6b41a828b 17 * and/or other materials provided with the distribution.
<> 156:95d6b41a828b 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 156:95d6b41a828b 19 * may be used to endorse or promote products derived from this software
<> 156:95d6b41a828b 20 * without specific prior written permission.
<> 156:95d6b41a828b 21 *
<> 156:95d6b41a828b 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 156:95d6b41a828b 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 156:95d6b41a828b 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 156:95d6b41a828b 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 156:95d6b41a828b 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 156:95d6b41a828b 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 156:95d6b41a828b 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 156:95d6b41a828b 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 156:95d6b41a828b 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 156:95d6b41a828b 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 156:95d6b41a828b 32 *
<> 156:95d6b41a828b 33 ******************************************************************************
<> 156:95d6b41a828b 34 */
<> 156:95d6b41a828b 35 #if defined(USE_FULL_LL_DRIVER)
<> 156:95d6b41a828b 36
<> 156:95d6b41a828b 37 /* Includes ------------------------------------------------------------------*/
<> 156:95d6b41a828b 38 #include "stm32f0xx_ll_crc.h"
<> 156:95d6b41a828b 39
<> 156:95d6b41a828b 40 #ifdef USE_FULL_ASSERT
<> 156:95d6b41a828b 41 #include "stm32_assert.h"
<> 156:95d6b41a828b 42 #else
<> 156:95d6b41a828b 43 #define assert_param(expr) ((void)0U)
<> 156:95d6b41a828b 44 #endif
<> 156:95d6b41a828b 45
<> 156:95d6b41a828b 46 /** @addtogroup STM32F0xx_LL_Driver
<> 156:95d6b41a828b 47 * @{
<> 156:95d6b41a828b 48 */
<> 156:95d6b41a828b 49
<> 156:95d6b41a828b 50 #if defined (CRC)
<> 156:95d6b41a828b 51
<> 156:95d6b41a828b 52 /** @addtogroup CRC_LL
<> 156:95d6b41a828b 53 * @{
<> 156:95d6b41a828b 54 */
<> 156:95d6b41a828b 55
<> 156:95d6b41a828b 56 /* Private types -------------------------------------------------------------*/
<> 156:95d6b41a828b 57 /* Private variables ---------------------------------------------------------*/
<> 156:95d6b41a828b 58 /* Private constants ---------------------------------------------------------*/
<> 156:95d6b41a828b 59 /* Private macros ------------------------------------------------------------*/
<> 156:95d6b41a828b 60 /* Private function prototypes -----------------------------------------------*/
<> 156:95d6b41a828b 61
<> 156:95d6b41a828b 62 /* Exported functions --------------------------------------------------------*/
<> 156:95d6b41a828b 63 /** @addtogroup CRC_LL_Exported_Functions
<> 156:95d6b41a828b 64 * @{
<> 156:95d6b41a828b 65 */
<> 156:95d6b41a828b 66
<> 156:95d6b41a828b 67 /** @addtogroup CRC_LL_EF_Init
<> 156:95d6b41a828b 68 * @{
<> 156:95d6b41a828b 69 */
<> 156:95d6b41a828b 70
<> 156:95d6b41a828b 71 /**
<> 156:95d6b41a828b 72 * @brief De-initialize CRC registers (Registers restored to their default values).
<> 156:95d6b41a828b 73 * @param CRCx CRC Instance
<> 156:95d6b41a828b 74 * @retval An ErrorStatus enumeration value:
<> 156:95d6b41a828b 75 * - SUCCESS: CRC registers are de-initialized
<> 156:95d6b41a828b 76 * - ERROR: CRC registers are not de-initialized
<> 156:95d6b41a828b 77 */
<> 156:95d6b41a828b 78 ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx)
<> 156:95d6b41a828b 79 {
<> 156:95d6b41a828b 80 ErrorStatus status = SUCCESS;
<> 156:95d6b41a828b 81
<> 156:95d6b41a828b 82 /* Check the parameters */
<> 156:95d6b41a828b 83 assert_param(IS_CRC_ALL_INSTANCE(CRCx));
<> 156:95d6b41a828b 84
<> 156:95d6b41a828b 85 if (CRCx == CRC)
<> 156:95d6b41a828b 86 {
<> 156:95d6b41a828b 87 #if defined(CRC_PROG_POLYNOMIAL_SUPPORT)
<> 156:95d6b41a828b 88 /* Set programmable polynomial size in CR register to reset value (32 bits)*/
<> 156:95d6b41a828b 89 LL_CRC_SetPolynomialSize(CRCx, LL_CRC_POLYLENGTH_32B);
<> 156:95d6b41a828b 90
<> 156:95d6b41a828b 91 /* Set programmable polynomial in POL register to reset value */
<> 156:95d6b41a828b 92 LL_CRC_SetPolynomialCoef(CRCx, LL_CRC_DEFAULT_CRC32_POLY);
<> 156:95d6b41a828b 93 #endif
<> 156:95d6b41a828b 94
<> 156:95d6b41a828b 95 /* Set INIT register to reset value */
<> 156:95d6b41a828b 96 LL_CRC_SetInitialData(CRCx, LL_CRC_DEFAULT_CRC_INITVALUE);
<> 156:95d6b41a828b 97
<> 156:95d6b41a828b 98 /* Set Reversibility options on I/O data values in CR register to reset value */
<> 156:95d6b41a828b 99 LL_CRC_SetInputDataReverseMode(CRCx, LL_CRC_INDATA_REVERSE_NONE);
<> 156:95d6b41a828b 100 LL_CRC_SetOutputDataReverseMode(CRCx, LL_CRC_OUTDATA_REVERSE_NONE);
<> 156:95d6b41a828b 101
<> 156:95d6b41a828b 102 /* Reset the CRC calculation unit */
<> 156:95d6b41a828b 103 LL_CRC_ResetCRCCalculationUnit(CRCx);
<> 156:95d6b41a828b 104
<> 156:95d6b41a828b 105 /* Reset IDR register */
<> 156:95d6b41a828b 106 LL_CRC_Write_IDR(CRCx, 0x00U);
<> 156:95d6b41a828b 107 }
<> 156:95d6b41a828b 108 else
<> 156:95d6b41a828b 109 {
<> 156:95d6b41a828b 110 status = ERROR;
<> 156:95d6b41a828b 111 }
<> 156:95d6b41a828b 112
<> 156:95d6b41a828b 113 return (status);
<> 156:95d6b41a828b 114 }
<> 156:95d6b41a828b 115
<> 156:95d6b41a828b 116 /**
<> 156:95d6b41a828b 117 * @}
<> 156:95d6b41a828b 118 */
<> 156:95d6b41a828b 119
<> 156:95d6b41a828b 120 /**
<> 156:95d6b41a828b 121 * @}
<> 156:95d6b41a828b 122 */
<> 156:95d6b41a828b 123
<> 156:95d6b41a828b 124 /**
<> 156:95d6b41a828b 125 * @}
<> 156:95d6b41a828b 126 */
<> 156:95d6b41a828b 127
<> 156:95d6b41a828b 128 #endif /* defined (CRC) */
<> 156:95d6b41a828b 129
<> 156:95d6b41a828b 130 /**
<> 156:95d6b41a828b 131 * @}
<> 156:95d6b41a828b 132 */
<> 156:95d6b41a828b 133
<> 156:95d6b41a828b 134 #endif /* USE_FULL_LL_DRIVER */
<> 156:95d6b41a828b 135
<> 156:95d6b41a828b 136 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
<> 156:95d6b41a828b 137