1 /**
2   ******************************************************************************
3   * @file    stm32h5xx_ll_pka.h
4   * @author  MCD Application Team
5   * @brief   Header file of PKA LL module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2022 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 STM32H5xx_LL_PKA_H
21 #define STM32H5xx_LL_PKA_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32h5xx.h"
29 
30 /** @addtogroup STM32H5xx_LL_Driver
31   * @{
32   */
33 
34 #if defined(PKA)
35 
36 /** @defgroup PKA_LL PKA
37   * @{
38   */
39 
40 /* Private variables ---------------------------------------------------------*/
41 
42 /* Exported types ------------------------------------------------------------*/
43 #if defined(USE_FULL_LL_DRIVER)
44 /** @defgroup PKA_LL_ES_INIT PKA Exported Init structure
45   * @{
46   */
47 
48 /**
49   * @brief  PKA Init structures definition
50   */
51 typedef struct
52 {
53   uint32_t Mode;          /*!< Specifies the PKA operation mode.
54                                This parameter can be a value of @ref PKA_LL_EC_MODE.
55 
56                                This feature can be modified afterwards using unitary function @ref LL_PKA_SetMode(). */
57 } LL_PKA_InitTypeDef;
58 
59 /**
60   * @}
61   */
62 #endif /* USE_FULL_LL_DRIVER */
63 
64 /* Exported constants --------------------------------------------------------*/
65 /** @defgroup PKA_LL_Exported_Constants PKA Exported Constants
66   * @{
67   */
68 
69 /** @defgroup PKA_LL_EC_GET_FLAG Get Flags Defines
70   * @brief    Flags defines which can be used with LL_PKA_ReadReg function
71   * @{
72   */
73 #define LL_PKA_SR_ADDRERRF                 PKA_SR_ADDRERRF
74 #define LL_PKA_SR_RAMERRF                  PKA_SR_RAMERRF
75 #define LL_PKA_SR_PROCENDF                 PKA_SR_PROCENDF
76 #define LL_PKA_SR_BUSY                     PKA_SR_BUSY
77 #define LL_PKA_SR_INITOK                   PKA_SR_INITOK
78 #define LL_PKA_SR_OPERRF                   PKA_SR_OPERRF
79 /**
80   * @}
81   */
82 
83 /** @defgroup PKA_LL_EC_IT IT Defines
84   * @brief    IT defines which can be used with LL_PKA_ReadReg and  LL_PKA_WriteReg functions
85   * @{
86   */
87 #define LL_PKA_CR_ADDRERRIE                PKA_CR_ADDRERRIE
88 #define LL_PKA_CR_RAMERRIE                 PKA_CR_RAMERRIE
89 #define LL_PKA_CR_PROCENDIE                PKA_CR_PROCENDIE
90 #define LL_PKA_CLRFR_PROCENDFC             PKA_CLRFR_PROCENDFC
91 #define LL_PKA_CLRFR_RAMERRFC              PKA_CLRFR_RAMERRFC
92 #define LL_PKA_CLRFR_ADDRERRFC             PKA_CLRFR_ADDRERRFC
93 #define LL_PKA_CR_OPERRIE                  PKA_CR_OPERRIE
94 #define LL_PKA_CLRFR_OPERRFC               PKA_CLRFR_OPERRFC
95 /**
96   * @}
97   */
98 
99 /** @defgroup PKA_LL_EC_MODE Operation Mode
100   * @brief    List of operation mode.
101   * @{
102   */
103 #define LL_PKA_MODE_MODULAR_EXP              ((uint32_t)0x00000000U)   /*!< modular exponentiation */
104 #define LL_PKA_MODE_MONTGOMERY_PARAM         ((uint32_t)0x00000001U)   /*!< Compute Montgomery parameter only */
105 #define LL_PKA_MODE_MODULAR_EXP_FAST         ((uint32_t)0x00000002U)   /*!< modular exponentiation fast mode */
106 #define LL_PKA_MODE_MODULAR_EXP_PROTECT      ((uint32_t)0x00000003U)   /*!< modular exponentiation protect mode */
107 #define LL_PKA_MODE_ECC_MUL                  ((uint32_t)0x00000020U)   /*!< compute ECC kP operation */
108 #define LL_PKA_MODE_ECC_COMPLETE_ADD         ((uint32_t)0x00000023U)   /*!< ECC complete addition */
109 #define LL_PKA_MODE_ECDSA_SIGNATURE          ((uint32_t)0x00000024U)   /*!< ECDSA signature */
110 #define LL_PKA_MODE_ECDSA_VERIFICATION       ((uint32_t)0x00000026U)   /*!< ECDSA verification */
111 #define LL_PKA_MODE_POINT_CHECK              ((uint32_t)0x00000028U)   /*!< Point check */
112 #define LL_PKA_MODE_RSA_CRT_EXP              ((uint32_t)0x00000007U)   /*!< RSA CRT exponentiation */
113 #define LL_PKA_MODE_MODULAR_INV              ((uint32_t)0x00000008U)   /*!< Modular inversion */
114 #define LL_PKA_MODE_ARITHMETIC_ADD           ((uint32_t)0x00000009U)   /*!< Arithmetic addition */
115 #define LL_PKA_MODE_ARITHMETIC_SUB           ((uint32_t)0x0000000AU)   /*!< Arithmetic subtraction */
116 #define LL_PKA_MODE_ARITHMETIC_MUL           ((uint32_t)0x0000000BU)   /*!< Arithmetic multiplication */
117 #define LL_PKA_MODE_COMPARISON               ((uint32_t)0x0000000CU)   /*!< Comparison */
118 #define LL_PKA_MODE_MODULAR_REDUC            ((uint32_t)0x0000000DU)   /*!< Modular reduction */
119 #define LL_PKA_MODE_MODULAR_ADD              ((uint32_t)0x0000000EU)   /*!< Modular addition */
120 #define LL_PKA_MODE_MODULAR_SUB              ((uint32_t)0x0000000FU)   /*!< Modular subtraction */
121 #define LL_PKA_MODE_MONTGOMERY_MUL           ((uint32_t)0x00000010U)   /*!< Montgomery multiplication */
122 #define LL_PKA_MODE_DOUBLE_BASE_LADDER       ((uint32_t)0x00000027U)   /*!< Double base ladder */
123 #define LL_PKA_MODE_ECC_PROJECTIVE_AFF       ((uint32_t)0x0000002FU)   /*!< ECC projective to affine */
124 
125 /**
126   * @}
127   */
128 
129 /**
130   * @}
131   */
132 
133 /* Exported macro ------------------------------------------------------------*/
134 /** @defgroup PKA_LL_Exported_Macros PKA Exported Macros
135   * @{
136   */
137 
138 /** @defgroup PKA_LL_EM_WRITE_READ Common Write and read registers Macros
139   * @{
140   */
141 
142 /**
143   * @brief  Write a value in PKA register
144   * @param  __INSTANCE__ PKA Instance
145   * @param  __REG__ Register to be written
146   * @param  __VALUE__ Value to be written in the register
147   * @retval None
148   */
149 #define LL_PKA_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
150 
151 /**
152   * @brief  Read a value in PKA register
153   * @param  __INSTANCE__ PKA Instance
154   * @param  __REG__ Register to be read
155   * @retval Register value
156   */
157 #define LL_PKA_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
158 /**
159   * @}
160   */
161 
162 /**
163   * @}
164   */
165 
166 /* Exported functions --------------------------------------------------------*/
167 /** @defgroup PKA_LL_Exported_Functions PKA Exported Functions
168   * @{
169   */
170 
171 /** @defgroup PKA_LL_EF_Configuration Configuration
172   * @{
173   */
174 
175 /**
176   * @brief  Configure PKA peripheral.
177   * @brief  Set PKA operating mode.
178   * @rmtoll CR           MODE          LL_PKA_Config
179   * @param  PKAx PKA Instance.
180   * @param  Mode This parameter can be one of the following values:
181   *         @arg @ref LL_PKA_MODE_MONTGOMERY_PARAM
182   *         @arg @ref LL_PKA_MODE_MODULAR_EXP
183   *         @arg @ref LL_PKA_MODE_ECDSA_SIGNATURE
184   *         @arg @ref LL_PKA_MODE_ECDSA_VERIFICATION
185   *         @arg @ref LL_PKA_MODE_POINT_CHECK
186   *         @arg @ref LL_PKA_MODE_RSA_CRT_EXP
187   *         @arg @ref LL_PKA_MODE_MODULAR_INV
188   *         @arg @ref LL_PKA_MODE_ARITHMETIC_ADD
189   *         @arg @ref LL_PKA_MODE_ARITHMETIC_SUB
190   *         @arg @ref LL_PKA_MODE_ARITHMETIC_MUL
191   *         @arg @ref LL_PKA_MODE_COMPARISON
192   *         @arg @ref LL_PKA_MODE_MODULAR_REDUC
193   *         @arg @ref LL_PKA_MODE_MODULAR_ADD
194   *         @arg @ref LL_PKA_MODE_MODULAR_SUB
195   *         @arg @ref LL_PKA_MODE_MONTGOMERY_MUL
196   *         @arg @ref LL_PKA_MODE_MODULAR_EXP_PROTECT
197   *         @arg @ref LL_PKA_MODE_DOUBLE_BASE_LADDER
198   *         @arg @ref LL_PKA_MODE_ECC_PROJECTIVE_AFF
199   *         @arg @ref LL_PKA_MODE_ECC_COMPLETE_ADD
200   *         @arg @ref LL_PKA_MODE_ECC_MUL
201   *         @arg @ref LL_PKA_MODE_MODULAR_EXP_FAST
202   */
LL_PKA_Config(PKA_TypeDef * PKAx,uint32_t Mode)203 __STATIC_INLINE void LL_PKA_Config(PKA_TypeDef *PKAx, uint32_t Mode)
204 {
205   MODIFY_REG(PKAx->CR, (PKA_CR_MODE), (Mode << PKA_CR_MODE_Pos));
206 }
207 
208 /**
209   * @brief  Enable PKA peripheral.
210   * @rmtoll CR           EN            LL_PKA_Enable
211   * @param  PKAx PKA Instance.
212   * @retval None
213   */
LL_PKA_Enable(PKA_TypeDef * PKAx)214 __STATIC_INLINE void LL_PKA_Enable(PKA_TypeDef *PKAx)
215 {
216   SET_BIT(PKAx->CR, PKA_CR_EN);
217 }
218 
219 /**
220   * @brief  Disable PKA peripheral.
221   * @rmtoll CR           EN            LL_PKA_Disable
222   * @param  PKAx PKA Instance.
223   * @retval None
224   */
LL_PKA_Disable(PKA_TypeDef * PKAx)225 __STATIC_INLINE void LL_PKA_Disable(PKA_TypeDef *PKAx)
226 {
227   CLEAR_BIT(PKAx->CR, PKA_CR_EN);
228 }
229 
230 /**
231   * @brief  Check if the PKA peripheral is enabled or disabled.
232   * @rmtoll CR           EN            LL_PKA_IsEnabled
233   * @param  PKAx PKA Instance.
234   * @retval State of bit (1 or 0).
235   */
LL_PKA_IsEnabled(PKA_TypeDef * PKAx)236 __STATIC_INLINE uint32_t LL_PKA_IsEnabled(PKA_TypeDef *PKAx)
237 {
238   return ((READ_BIT(PKAx->CR, PKA_CR_EN) == (PKA_CR_EN)) ? 1UL : 0UL);
239 }
240 
241 /**
242   * @brief  Set PKA operating mode.
243   * @rmtoll CR           MODE          LL_PKA_SetMode
244   * @param  PKAx PKA Instance.
245   * @param  Mode This parameter can be one of the following values:
246   *         @arg @ref LL_PKA_MODE_MONTGOMERY_PARAM
247   *         @arg @ref LL_PKA_MODE_MODULAR_EXP
248   *         @arg @ref LL_PKA_MODE_ECDSA_SIGNATURE
249   *         @arg @ref LL_PKA_MODE_ECDSA_VERIFICATION
250   *         @arg @ref LL_PKA_MODE_POINT_CHECK
251   *         @arg @ref LL_PKA_MODE_RSA_CRT_EXP
252   *         @arg @ref LL_PKA_MODE_MODULAR_INV
253   *         @arg @ref LL_PKA_MODE_ARITHMETIC_ADD
254   *         @arg @ref LL_PKA_MODE_ARITHMETIC_SUB
255   *         @arg @ref LL_PKA_MODE_ARITHMETIC_MUL
256   *         @arg @ref LL_PKA_MODE_COMPARISON
257   *         @arg @ref LL_PKA_MODE_MODULAR_REDUC
258   *         @arg @ref LL_PKA_MODE_MODULAR_ADD
259   *         @arg @ref LL_PKA_MODE_MODULAR_SUB
260   *         @arg @ref LL_PKA_MODE_MONTGOMERY_MUL
261   *         @arg @ref LL_PKA_MODE_MODULAR_EXP_PROTECT
262   *         @arg @ref LL_PKA_MODE_DOUBLE_BASE_LADDER
263   *         @arg @ref LL_PKA_MODE_ECC_PROJECTIVE_AFF
264   *         @arg @ref LL_PKA_MODE_ECC_COMPLETE_ADD
265   *         @arg @ref LL_PKA_MODE_ECC_MUL
266   *         @arg @ref LL_PKA_MODE_MODULAR_EXP_FAST
267   * @retval None
268   */
LL_PKA_SetMode(PKA_TypeDef * PKAx,uint32_t Mode)269 __STATIC_INLINE void LL_PKA_SetMode(PKA_TypeDef *PKAx, uint32_t Mode)
270 {
271   MODIFY_REG(PKAx->CR, PKA_CR_MODE, Mode << PKA_CR_MODE_Pos);
272 }
273 
274 /**
275   * @brief  Get PKA operating mode.
276   * @rmtoll CR           MODE          LL_PKA_GetMode
277   * @param  PKAx PKA Instance.
278   * @retval Returned value can be one of the following values:
279   *         @arg @ref LL_PKA_MODE_MONTGOMERY_PARAM
280   *         @arg @ref LL_PKA_MODE_MODULAR_EXP
281   *         @arg @ref LL_PKA_MODE_ECDSA_SIGNATURE
282   *         @arg @ref LL_PKA_MODE_ECDSA_VERIFICATION
283   *         @arg @ref LL_PKA_MODE_POINT_CHECK
284   *         @arg @ref LL_PKA_MODE_RSA_CRT_EXP
285   *         @arg @ref LL_PKA_MODE_MODULAR_INV
286   *         @arg @ref LL_PKA_MODE_ARITHMETIC_ADD
287   *         @arg @ref LL_PKA_MODE_ARITHMETIC_SUB
288   *         @arg @ref LL_PKA_MODE_ARITHMETIC_MUL
289   *         @arg @ref LL_PKA_MODE_COMPARISON
290   *         @arg @ref LL_PKA_MODE_MODULAR_REDUC
291   *         @arg @ref LL_PKA_MODE_MODULAR_ADD
292   *         @arg @ref LL_PKA_MODE_MODULAR_SUB
293   *         @arg @ref LL_PKA_MODE_MONTGOMERY_MUL
294   *         @arg @ref LL_PKA_MODE_MODULAR_EXP_PROTECT
295   *         @arg @ref LL_PKA_MODE_DOUBLE_BASE_LADDER
296   *         @arg @ref LL_PKA_MODE_ECC_PROJECTIVE_AFF
297   *         @arg @ref LL_PKA_MODE_ECC_COMPLETE_ADD
298   *         @arg @ref LL_PKA_MODE_ECC_MUL
299   *         @arg @ref LL_PKA_MODE_MODULAR_EXP_FAST
300   */
LL_PKA_GetMode(PKA_TypeDef * PKAx)301 __STATIC_INLINE uint32_t LL_PKA_GetMode(PKA_TypeDef *PKAx)
302 {
303   return (uint32_t)(READ_BIT(PKAx->CR, PKA_CR_MODE) >> PKA_CR_MODE_Pos);
304 }
305 
306 /**
307   * @brief  Start the operation selected using LL_PKA_SetMode.
308   * @rmtoll CR           START         LL_PKA_Start
309   * @param  PKAx PKA Instance.
310   * @retval None
311   */
LL_PKA_Start(PKA_TypeDef * PKAx)312 __STATIC_INLINE void LL_PKA_Start(PKA_TypeDef *PKAx)
313 {
314   SET_BIT(PKAx->CR, PKA_CR_START);
315 }
316 
317 /**
318   * @}
319   */
320 
321 /** @defgroup PKA_LL_EF_IT_Management IT_Management
322   * @{
323   */
324 
325 /**
326   * @brief  Enable address error interrupt.
327   * @rmtoll CR           ADDRERRIE     LL_PKA_EnableIT_ADDRERR
328   * @param  PKAx PKA Instance.
329   * @retval None
330   */
LL_PKA_EnableIT_ADDRERR(PKA_TypeDef * PKAx)331 __STATIC_INLINE void LL_PKA_EnableIT_ADDRERR(PKA_TypeDef *PKAx)
332 {
333   SET_BIT(PKAx->CR, PKA_CR_ADDRERRIE);
334 }
335 
336 /**
337   * @brief  Enable RAM error interrupt.
338   * @rmtoll CR           RAMERRIE      LL_PKA_EnableIT_RAMERR
339   * @param  PKAx PKA Instance.
340   * @retval None
341   */
LL_PKA_EnableIT_RAMERR(PKA_TypeDef * PKAx)342 __STATIC_INLINE void LL_PKA_EnableIT_RAMERR(PKA_TypeDef *PKAx)
343 {
344   SET_BIT(PKAx->CR, PKA_CR_RAMERRIE);
345 }
346 
347 /**
348   * @brief  Enable OPERATION error interrupt.
349   * @rmtoll CR           OPERRIE      LL_PKA_EnableIT_OPERR
350   * @param  PKAx PKA Instance.
351   * @retval None
352   */
LL_PKA_EnableIT_OPERR(PKA_TypeDef * PKAx)353 __STATIC_INLINE void LL_PKA_EnableIT_OPERR(PKA_TypeDef *PKAx)
354 {
355   SET_BIT(PKAx->CR, PKA_CR_OPERRIE);
356 }
357 
358 /**
359   * @brief  Enable end of operation interrupt.
360   * @rmtoll CR           PROCENDIE     LL_PKA_EnableIT_PROCEND
361   * @param  PKAx PKA Instance.
362   * @retval None
363   */
LL_PKA_EnableIT_PROCEND(PKA_TypeDef * PKAx)364 __STATIC_INLINE void LL_PKA_EnableIT_PROCEND(PKA_TypeDef *PKAx)
365 {
366   SET_BIT(PKAx->CR, PKA_CR_PROCENDIE);
367 }
368 
369 /**
370   * @brief  Disable address error interrupt.
371   * @rmtoll CR           ADDRERRIE     LL_PKA_DisableIT_ADDERR
372   * @param  PKAx PKA Instance.
373   * @retval None
374   */
LL_PKA_DisableIT_ADDERR(PKA_TypeDef * PKAx)375 __STATIC_INLINE void LL_PKA_DisableIT_ADDERR(PKA_TypeDef *PKAx)
376 {
377   CLEAR_BIT(PKAx->CR, PKA_CR_ADDRERRIE);
378 }
379 
380 /**
381   * @brief  Disable RAM error interrupt.
382   * @rmtoll CR           RAMERRIE      LL_PKA_DisableIT_RAMERR
383   * @param  PKAx PKA Instance.
384   * @retval None
385   */
LL_PKA_DisableIT_RAMERR(PKA_TypeDef * PKAx)386 __STATIC_INLINE void LL_PKA_DisableIT_RAMERR(PKA_TypeDef *PKAx)
387 {
388   CLEAR_BIT(PKAx->CR, PKA_CR_RAMERRIE);
389 }
390 
391 /**
392   * @brief  Disable End of operation interrupt.
393   * @rmtoll CR           PROCENDIE     LL_PKA_DisableIT_PROCEND
394   * @param  PKAx PKA Instance.
395   * @retval None
396   */
LL_PKA_DisableIT_PROCEND(PKA_TypeDef * PKAx)397 __STATIC_INLINE void LL_PKA_DisableIT_PROCEND(PKA_TypeDef *PKAx)
398 {
399   CLEAR_BIT(PKAx->CR, PKA_CR_PROCENDIE);
400 }
401 
402 /**
403   * @brief  Disable OPERATION error interrupt.
404   * @rmtoll CR           OPERRIE      LL_PKA_EnableIT_OPERR
405   * @param  PKAx PKA Instance.
406   * @retval None
407   */
LL_PKA_DisableIT_OPERR(PKA_TypeDef * PKAx)408 __STATIC_INLINE void LL_PKA_DisableIT_OPERR(PKA_TypeDef *PKAx)
409 {
410   CLEAR_BIT(PKAx->CR, PKA_CR_OPERRIE);
411 }
412 
413 /**
414   * @brief  Check if address error interrupt is enabled.
415   * @rmtoll CR           ADDRERRIE     LL_PKA_IsEnabledIT_ADDRERR
416   * @param  PKAx PKA Instance.
417   * @retval State of bit (1 or 0).
418   */
LL_PKA_IsEnabledIT_ADDRERR(PKA_TypeDef * PKAx)419 __STATIC_INLINE uint32_t LL_PKA_IsEnabledIT_ADDRERR(PKA_TypeDef *PKAx)
420 {
421   return ((READ_BIT(PKAx->CR, PKA_CR_ADDRERRIE) == (PKA_CR_ADDRERRIE)) ? 1UL : 0UL);
422 }
423 
424 /**
425   * @brief  Check if RAM error interrupt is enabled.
426   * @rmtoll CR           RAMERRIE      LL_PKA_IsEnabledIT_RAMERR
427   * @param  PKAx PKA Instance.
428   * @retval State of bit (1 or 0).
429   */
LL_PKA_IsEnabledIT_RAMERR(PKA_TypeDef * PKAx)430 __STATIC_INLINE uint32_t LL_PKA_IsEnabledIT_RAMERR(PKA_TypeDef *PKAx)
431 {
432   return ((READ_BIT(PKAx->CR, PKA_CR_RAMERRIE) == (PKA_CR_RAMERRIE)) ? 1UL : 0UL);
433 }
434 
435 /**
436   * @brief  Check if OPERATION error interrupt is enabled.
437   * @rmtoll CR           OPERRIE      LL_PKA_IsEnabledIT_OPERR
438   * @param  PKAx PKA Instance.
439   * @retval State of bit (1 or 0).
440   */
LL_PKA_IsEnabledIT_OPERR(PKA_TypeDef * PKAx)441 __STATIC_INLINE uint32_t LL_PKA_IsEnabledIT_OPERR(PKA_TypeDef *PKAx)
442 {
443   return ((READ_BIT(PKAx->CR, PKA_CR_OPERRIE) == (PKA_CR_OPERRIE)) ? 1UL : 0UL);
444 }
445 
446 /**
447   * @brief  Check if end of operation interrupt is enabled.
448   * @rmtoll CR           PROCENDIE     LL_PKA_IsEnabledIT_PROCEND
449   * @param  PKAx PKA Instance.
450   * @retval State of bit (1 or 0).
451   */
LL_PKA_IsEnabledIT_PROCEND(PKA_TypeDef * PKAx)452 __STATIC_INLINE uint32_t LL_PKA_IsEnabledIT_PROCEND(PKA_TypeDef *PKAx)
453 {
454   return ((READ_BIT(PKAx->CR, PKA_CR_PROCENDIE) == (PKA_CR_PROCENDIE)) ? 1UL : 0UL);
455 }
456 
457 /**
458   * @}
459   */
460 
461 /** @defgroup PKA_LL_EF_FLAG_Management PKA flag management
462   * @{
463   */
464 
465 /**
466   * @brief  Get PKA address error flag.
467   * @rmtoll SR           ADDRERRF      LL_PKA_IsActiveFlag_ADDRERR
468   * @param  PKAx PKA Instance.
469   * @retval State of bit (1 or 0).
470   */
LL_PKA_IsActiveFlag_ADDRERR(PKA_TypeDef * PKAx)471 __STATIC_INLINE uint32_t LL_PKA_IsActiveFlag_ADDRERR(PKA_TypeDef *PKAx)
472 {
473   return ((READ_BIT(PKAx->SR, PKA_SR_ADDRERRF) == (PKA_SR_ADDRERRF)) ? 1UL : 0UL);
474 }
475 
476 /**
477   * @brief  Get PKA RAM error flag.
478   * @rmtoll SR           RAMERRF       LL_PKA_IsActiveFlag_RAMERR
479   * @param  PKAx PKA Instance.
480   * @retval State of bit (1 or 0).
481   */
LL_PKA_IsActiveFlag_RAMERR(PKA_TypeDef * PKAx)482 __STATIC_INLINE uint32_t LL_PKA_IsActiveFlag_RAMERR(PKA_TypeDef *PKAx)
483 {
484   return ((READ_BIT(PKAx->SR, PKA_SR_RAMERRF) == (PKA_SR_RAMERRF)) ? 1UL : 0UL);
485 }
486 
487 /**
488   * @brief  Get PKA OPERATION error flag.
489   * @rmtoll SR           OPERRF       LL_PKA_IsActiveFlag_OPERR
490   * @param  PKAx PKA Instance.
491   * @retval State of bit (1 or 0).
492   */
LL_PKA_IsActiveFlag_OPERR(PKA_TypeDef * PKAx)493 __STATIC_INLINE uint32_t LL_PKA_IsActiveFlag_OPERR(PKA_TypeDef *PKAx)
494 {
495   return ((READ_BIT(PKAx->SR, PKA_SR_OPERRF) == (PKA_SR_OPERRF)) ? 1UL : 0UL);
496 }
497 
498 /**
499   * @brief  Get PKA end of operation flag.
500   * @rmtoll SR           PROCENDF      LL_PKA_IsActiveFlag_PROCEND
501   * @param  PKAx PKA Instance.
502   * @retval State of bit (1 or 0).
503   */
LL_PKA_IsActiveFlag_PROCEND(PKA_TypeDef * PKAx)504 __STATIC_INLINE uint32_t LL_PKA_IsActiveFlag_PROCEND(PKA_TypeDef *PKAx)
505 {
506   return ((READ_BIT(PKAx->SR, PKA_SR_PROCENDF) == (PKA_SR_PROCENDF)) ? 1UL : 0UL);
507 }
508 
509 /**
510   * @brief  Get PKA busy flag.
511   * @rmtoll SR           BUSY          LL_PKA_IsActiveFlag_BUSY
512   * @param  PKAx PKA Instance.
513   * @retval State of bit (1 or 0).
514   */
LL_PKA_IsActiveFlag_BUSY(PKA_TypeDef * PKAx)515 __STATIC_INLINE uint32_t LL_PKA_IsActiveFlag_BUSY(PKA_TypeDef *PKAx)
516 {
517   return ((READ_BIT(PKAx->SR, PKA_SR_BUSY) == (PKA_SR_BUSY)) ? 1UL : 0UL);
518 }
519 
520 /**
521   * @brief  Clear PKA address error flag.
522   * @rmtoll CLRFR        ADDRERRFC     LL_PKA_ClearFlag_ADDERR
523   * @param  PKAx PKA Instance.
524   * @retval None
525   */
LL_PKA_ClearFlag_ADDERR(PKA_TypeDef * PKAx)526 __STATIC_INLINE void LL_PKA_ClearFlag_ADDERR(PKA_TypeDef *PKAx)
527 {
528   SET_BIT(PKAx->CLRFR, PKA_CLRFR_ADDRERRFC);
529 }
530 
531 /**
532   * @brief  Clear PKA RAM error flag.
533   * @rmtoll CLRFR        RAMERRFC      LL_PKA_ClearFlag_RAMERR
534   * @param  PKAx PKA Instance.
535   * @retval None
536   */
LL_PKA_ClearFlag_RAMERR(PKA_TypeDef * PKAx)537 __STATIC_INLINE void LL_PKA_ClearFlag_RAMERR(PKA_TypeDef *PKAx)
538 {
539   SET_BIT(PKAx->CLRFR, PKA_CLRFR_RAMERRFC);
540 }
541 
542 /**
543   * @brief  Clear PKA OPERATION error flag.
544   * @rmtoll CLRFR        OPERRFC      LL_PKA_ClearFlag_OPERR
545   * @param  PKAx PKA Instance.
546   * @retval None
547   */
LL_PKA_ClearFlag_OPERR(PKA_TypeDef * PKAx)548 __STATIC_INLINE void LL_PKA_ClearFlag_OPERR(PKA_TypeDef *PKAx)
549 {
550   SET_BIT(PKAx->CLRFR, PKA_CLRFR_OPERRFC);
551 }
552 
553 /**
554   * @brief  Clear PKA end of operation flag.
555   * @rmtoll CLRFR        PROCENDFC     LL_PKA_ClearFlag_PROCEND
556   * @param  PKAx PKA Instance.
557   * @retval None
558   */
LL_PKA_ClearFlag_PROCEND(PKA_TypeDef * PKAx)559 __STATIC_INLINE void LL_PKA_ClearFlag_PROCEND(PKA_TypeDef *PKAx)
560 {
561   SET_BIT(PKAx->CLRFR, PKA_CLRFR_PROCENDFC);
562 }
563 
564 /**
565   * @}
566   */
567 
568 #if defined(USE_FULL_LL_DRIVER)
569 
570 /** @defgroup PKA_LL_EF_Init Initialization and de-initialization functions
571   * @{
572   */
573 
574 ErrorStatus LL_PKA_DeInit(PKA_TypeDef *PKAx);
575 ErrorStatus LL_PKA_Init(PKA_TypeDef *PKAx, LL_PKA_InitTypeDef *PKA_InitStruct);
576 void LL_PKA_StructInit(LL_PKA_InitTypeDef *PKA_InitStruct);
577 
578 /**
579   * @}
580   */
581 
582 #endif /* USE_FULL_LL_DRIVER */
583 /**
584   * @}
585   */
586 
587 /**
588   * @}
589   */
590 
591 #endif /* defined(PKA) */
592 
593 /**
594   * @}
595   */
596 
597 #ifdef __cplusplus
598 }
599 #endif
600 
601 #endif /* STM32H5xx_LL_PKA_H */
602