Subversion Repositories AFRtranscoder

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
/**
2
  ******************************************************************************
3
  * @file    stm32f1xx_ll_crc.h
4
  * @author  MCD Application Team
5
  * @brief   Header file of CRC LL module.
6
  ******************************************************************************
7
  * @attention
8
  *
9
  * Copyright (c) 2016 STMicroelectronics.
10
  * All rights reserved.
11
  *
12
  * This software is licensed under terms that can be found in the LICENSE file
13
  * in the root directory of this software component.
14
  * If no LICENSE file comes with this software, it is provided AS-IS.
15
  *
16
  ******************************************************************************
17
  */
18
 
19
/* Define to prevent recursive inclusion -------------------------------------*/
20
#ifndef STM32F1xx_LL_CRC_H
21
#define STM32F1xx_LL_CRC_H
22
 
23
#ifdef __cplusplus
24
extern "C" {
25
#endif
26
 
27
/* Includes ------------------------------------------------------------------*/
28
#include "stm32f1xx.h"
29
 
30
/** @addtogroup STM32F1xx_LL_Driver
31
  * @{
32
  */
33
 
34
#if defined(CRC)
35
 
36
/** @defgroup CRC_LL CRC
37
  * @{
38
  */
39
 
40
/* Private types -------------------------------------------------------------*/
41
/* Private variables ---------------------------------------------------------*/
42
/* Private constants ---------------------------------------------------------*/
43
/* Private macros ------------------------------------------------------------*/
44
 
45
/* Exported types ------------------------------------------------------------*/
46
/* Exported constants --------------------------------------------------------*/
47
/** @defgroup CRC_LL_Exported_Constants CRC Exported Constants
48
  * @{
49
  */
50
 
51
/**
52
  * @}
53
  */
54
 
55
/* Exported macro ------------------------------------------------------------*/
56
/** @defgroup CRC_LL_Exported_Macros CRC Exported Macros
57
  * @{
58
  */
59
 
60
/** @defgroup CRC_LL_EM_WRITE_READ Common Write and read registers Macros
61
  * @{
62
  */
63
 
64
/**
65
  * @brief  Write a value in CRC register
66
  * @param  __INSTANCE__ CRC Instance
67
  * @param  __REG__ Register to be written
68
  * @param  __VALUE__ Value to be written in the register
69
  * @retval None
70
  */
71
#define LL_CRC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, __VALUE__)
72
 
73
/**
74
  * @brief  Read a value in CRC register
75
  * @param  __INSTANCE__ CRC Instance
76
  * @param  __REG__ Register to be read
77
  * @retval Register value
78
  */
79
#define LL_CRC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
80
/**
81
  * @}
82
  */
83
 
84
/**
85
  * @}
86
  */
87
 
88
 
89
/* Exported functions --------------------------------------------------------*/
90
/** @defgroup CRC_LL_Exported_Functions CRC Exported Functions
91
  * @{
92
  */
93
 
94
/** @defgroup CRC_LL_EF_Configuration CRC Configuration functions
95
  * @{
96
  */
97
 
98
/**
99
  * @brief  Reset the CRC calculation unit.
100
  * @note   If Programmable Initial CRC value feature
101
  *         is available, also set the Data Register to the value stored in the
102
  *         CRC_INIT register, otherwise, reset Data Register to its default value.
103
  * @rmtoll CR           RESET         LL_CRC_ResetCRCCalculationUnit
104
  * @param  CRCx CRC Instance
105
  * @retval None
106
  */
107
__STATIC_INLINE void LL_CRC_ResetCRCCalculationUnit(CRC_TypeDef *CRCx)
108
{
109
  SET_BIT(CRCx->CR, CRC_CR_RESET);
110
}
111
 
112
/**
113
  * @}
114
  */
115
 
116
/** @defgroup CRC_LL_EF_Data_Management Data_Management
117
  * @{
118
  */
119
 
120
/**
121
  * @brief  Write given 32-bit data to the CRC calculator
122
  * @rmtoll DR           DR            LL_CRC_FeedData32
123
  * @param  CRCx CRC Instance
124
  * @param  InData value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFFFFFFFF
125
  * @retval None
126
  */
127
__STATIC_INLINE void LL_CRC_FeedData32(CRC_TypeDef *CRCx, uint32_t InData)
128
{
129
  WRITE_REG(CRCx->DR, InData);
130
}
131
 
132
/**
133
  * @brief  Return current CRC calculation result. 32 bits value is returned.
134
  * @rmtoll DR           DR            LL_CRC_ReadData32
135
  * @param  CRCx CRC Instance
136
  * @retval Current CRC calculation result as stored in CRC_DR register (32 bits).
137
  */
138
__STATIC_INLINE uint32_t LL_CRC_ReadData32(const CRC_TypeDef *CRCx)
139
{
140
  return (uint32_t)(READ_REG(CRCx->DR));
141
}
142
 
143
/**
144
  * @brief  Return data stored in the Independent Data(IDR) register.
145
  * @note   This register can be used as a temporary storage location for one byte.
146
  * @rmtoll IDR          IDR           LL_CRC_Read_IDR
147
  * @param  CRCx CRC Instance
148
  * @retval Value stored in CRC_IDR register (General-purpose 8-bit data register).
149
  */
150
__STATIC_INLINE uint32_t LL_CRC_Read_IDR(CRC_TypeDef *CRCx)
151
{
152
  return (uint32_t)(READ_REG(CRCx->IDR));
153
}
154
 
155
/**
156
  * @brief  Store data in the Independent Data(IDR) register.
157
  * @note   This register can be used as a temporary storage location for one byte.
158
  * @rmtoll IDR          IDR           LL_CRC_Write_IDR
159
  * @param  CRCx CRC Instance
160
  * @param  InData value to be stored in CRC_IDR register (8-bit) between Min_Data=0 and Max_Data=0xFF
161
  * @retval None
162
  */
163
__STATIC_INLINE void LL_CRC_Write_IDR(CRC_TypeDef *CRCx, uint32_t InData)
164
{
165
  *((uint8_t __IO *)(&CRCx->IDR)) = (uint8_t) InData;
166
}
167
/**
168
  * @}
169
  */
170
 
171
#if defined(USE_FULL_LL_DRIVER)
172
/** @defgroup CRC_LL_EF_Init Initialization and de-initialization functions
173
  * @{
174
  */
175
 
176
ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx);
177
 
178
/**
179
  * @}
180
  */
181
#endif /* USE_FULL_LL_DRIVER */
182
 
183
/**
184
  * @}
185
  */
186
 
187
/**
188
  * @}
189
  */
190
 
191
#endif /* defined(CRC) */
192
 
193
/**
194
  * @}
195
  */
196
 
197
#ifdef __cplusplus
198
}
199
#endif
200
 
201
#endif /* STM32F1xx_LL_CRC_H */