1 /**
2   ******************************************************************************
3   * @file    tae32f53xx_ll_fpll.c
4   * @author  MCD Application Team
5   * @brief   FPLL LL Module Driver
6   *
7   ******************************************************************************
8   * @attention
9   *
10   * <h2><center>&copy; Copyright (c) 2020 Tai-Action.
11   * All rights reserved.</center></h2>
12   *
13   * This software is licensed by Tai-Action under BSD 3-Clause license,
14   * the "License"; You may not use this file except in compliance with the
15   * License. You may obtain a copy of the License at:
16   *                        opensource.org/licenses/BSD-3-Clause
17   *
18   ******************************************************************************
19   */
20 
21 /* Includes ------------------------------------------------------------------*/
22 #include "tae32f53xx_ll.h"
23 
24 
25 #define DBG_TAG             "FPLL"
26 #define DBG_LVL             DBG_ERROR
27 #include "dbg/tae32f53xx_dbg.h"
28 
29 
30 /** @addtogroup TAE32F53xx_LL_Driver
31   * @{
32   */
33 
34 /** @defgroup FPLL_LL FPLL LL
35   * @brief    FPLL LL Module Driver
36   * @{
37   */
38 
39 #ifdef LL_FPLL_MODULE_ENABLED
40 
41 /* Private typedef -----------------------------------------------------------*/
42 /* Private define ------------------------------------------------------------*/
43 /* Private macro -------------------------------------------------------------*/
44 /* Private variables ---------------------------------------------------------*/
45 /* Private function prototypes -----------------------------------------------*/
46 /* Exported functions --------------------------------------------------------*/
47 /** @defgroup FPLL_LL_Exported_Functions FPLL LL Exported Functions
48   * @brief    FPLL LL Exported Functions
49   * @{
50   */
51 
52 /** @defgroup FPLL_LL_Exported_Functions_Group1 Initialization and de-initialization functions
53   * @brief    Initialization and de-initialization functions
54   * @{
55   */
56 
57 /**
58   * @brief  Initializes the FPLL peripheral
59   * @param  Instance Specifies FPLL peripheral
60   * @return Status of the Initialization
61   */
LL_FPLL_Init(FPLL_TypeDef * Instance)62 LL_StatusETypeDef LL_FPLL_Init(FPLL_TypeDef *Instance)
63 {
64     /* Init the low level hardware eg. Clock, NVIC */
65     LL_FPLL_MspInit(Instance);
66 
67     return LL_OK;
68 }
69 
70 /**
71   * @brief  DeInitializes the FPLL peripheral
72   * @param  Instance Specifies FPLL peripheral
73   * @return Status of the DeInitialization
74   */
LL_FPLL_DeInit(FPLL_TypeDef * Instance)75 LL_StatusETypeDef LL_FPLL_DeInit(FPLL_TypeDef *Instance)
76 {
77     /* Init the low level hardware eg. Clock, NVIC */
78     LL_FPLL_MspDeInit(Instance);
79 
80     return LL_OK;
81 }
82 
83 /**
84   * @brief  Initializes the FPLL MSP
85   * @param  Instance Specifies FPLL peripheral
86   * @retval None
87   */
LL_FPLL_MspInit(FPLL_TypeDef * Instance)88 __WEAK void LL_FPLL_MspInit(FPLL_TypeDef *Instance)
89 {
90     /* Prevent unused argument(s) compilation warning */
91     LL_UNUSED(Instance);
92     /* NOTE: This function should not be modified, when the callback is needed,
93              the LL_FPLL_MspInit could be implemented in the user file
94      */
95 }
96 
97 /**
98   * @brief  DeInitializes the FPLL MSP
99   * @param  Instance Specifies FPLL peripheral
100   * @retval None
101   */
LL_FPLL_MspDeInit(FPLL_TypeDef * Instance)102 __WEAK void LL_FPLL_MspDeInit(FPLL_TypeDef *Instance)
103 {
104     /* Prevent unused argument(s) compilation warning */
105     LL_UNUSED(Instance);
106     /* NOTE: This function should not be modified, when the callback is needed,
107              the LL_FPLL_MspDeInit could be implemented in the user file
108      */
109 }
110 /**
111   * @}
112   */
113 
114 
115 /** @defgroup FPLL_LL_Exported_Functions_Group2 FPLL Config Fucntions
116   * @brief    FPLL Config Fucntions
117   * @{
118   */
119 
120 /**
121   * @brief  FPLL LL Start
122   * @param  Instance Specifies FPLL peripheral
123   * @param  integer  FPLL Div integer
124   * @param  frac     FPLL Div Fraction
125   * @return FPLL Start Result
126   */
LL_FPLL_DivStart(FPLL_TypeDef * Instance,uint16_t integer,uint16_t frac)127 LL_StatusETypeDef LL_FPLL_DivStart(FPLL_TypeDef *Instance, uint16_t integer, uint16_t frac)
128 {
129     if (Instance == NULL) {
130         LOG_E("FPLL Div config params error!\n");
131         return LL_ERROR;
132     }
133 
134     __LL_FPLL_DivInt_Set(Instance, integer);
135     __LL_FPLL_DivFrac_Set(Instance, frac);
136     __LL_FPLL_En(Instance);
137     __LL_FPLL_Start(Instance);
138 
139     return LL_OK;
140 }
141 /**
142   * @}
143   */
144 
145 /**
146   * @}
147   */
148 
149 
150 /* Private functions ---------------------------------------------------------*/
151 
152 
153 #endif  /* LL_FPLL_MODULE_ENABLED */
154 
155 
156 /**
157   * @}
158   */
159 
160 /**
161   * @}
162   */
163 
164 
165 /************************* (C) COPYRIGHT Tai-Action *****END OF FILE***********/
166 
167