1 /**
2   *********************************************************************************
3   *
4   * @file    ald_calc.c
5   * @brief   CALC module driver.
6   *
7   * @version V1.0
8   * @date    26 Jun 2019
9   * @author  AE Team
10   * @note
11   *          Change Logs:
12   *          Date            Author          Notes
13   *          26 Jun 2019     AE Team         The first version
14   *
15   * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
16   *
17   * SPDX-License-Identifier: Apache-2.0
18   *
19   * Licensed under the Apache License, Version 2.0 (the License); you may
20   * not use this file except in compliance with the License.
21   * You may obtain a copy of the License at
22   *
23   * www.apache.org/licenses/LICENSE-2.0
24   *
25   * Unless required by applicable law or agreed to in writing, software
26   * distributed under the License is distributed on an AS IS BASIS, WITHOUT
27   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28   * See the License for the specific language governing permissions and
29   * limitations under the License.
30   **********************************************************************************
31   */
32 
33 #include "ald_conf.h"
34 
35 
36 /** @addtogroup ES32FXXX_ALD
37   * @{
38   */
39 
40 /** @defgroup CALC CALC
41   * @brief CALC module driver
42   * @{
43   */
44 #ifdef ALD_CALC
45 
46 /** @defgroup CALC_Public_Functions CALC Public Functions
47   * @brief    Accelerating calculate functions
48   *
49   * @verbatim
50   ==============================================================================
51               ##### Accelerating calculate functions #####
52   ==============================================================================
53     [..]  This section provides functions allowing to:
54       (+) Square root operation.
55 
56     @endverbatim
57   * @{
58   */
59 
60 /**
61   * @brief  Square root operation.
62   * @param  data: The  radicand.
63   * @retval The value of square root.
64   */
ald_calc_sqrt(uint32_t data)65 uint32_t ald_calc_sqrt(uint32_t data)
66 {
67 	WRITE_REG(CALC->RDCND, data);
68 	while (READ_BIT(CALC->SQRTSR, CALC_SQRTSR_BUSY_MSK));
69 
70 	return READ_REG(CALC->SQRTRES);
71 }
72 /**
73   * @}
74   */
75 #endif /* ALD_CALC */
76 /**
77   * @}
78   */
79 /**
80   * @}
81   */
82