1 /**
2   ******************************************************************************
3   * @file    stm32n6xx_ll_venc.c
4   * @author  GPM Application Team
5   * @brief   VENC LL module driver
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2023 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 /* Includes ------------------------------------------------------------------*/
20 #include "stm32n6xx_ll_venc.h"
21 #include "stm32n6xx_ll_bus.h"
22 #ifdef  USE_FULL_ASSERT
23 #include "stm32_assert.h"
24 #else
25 #define assert_param(expr) ((void)0U)
26 #endif /* USE_FULL_ASSERT */
27 
28 
29 /** @addtogroup STM32N6xx_LL_Driver
30   * @{
31   */
32 #if defined(VENC)
33 
34 /** @addtogroup VENC_LL
35   * @{
36   */
37 
38 
39 /* Global variables ----------------------------------------------------------*/
40 /** @addtogroup VENC_Global_Variables
41   * @{
42   */
43 
44 
45 
46 /**
47   * @}
48   */
49 
50 /* Private typedef -----------------------------------------------------------*/
51 /** @defgroup VENC_Private_Types VENC Private Types
52   * @{
53   */
54 
55 /**
56   * @}
57   */
58 
59 /* Private defines -----------------------------------------------------------*/
60 /** @defgroup VENC_Private_Constants VENC Private Constants
61   * @{
62 
63   */
64 
65 
66 /**
67   * @}
68   */
69 
70 /* Private macros ------------------------------------------------------------*/
71 /** @defgroup VENC_Private_Macros VENC Private Macros
72   * @{
73   */
74 
75 /**
76   * @}
77   */
78 
79 /* Private variables ---------------------------------------------------------*/
80 /** @defgroup VENC_Private_Variables VENC Private Variables
81   * @{
82 
83  */
84 
85 
86 
87 /**
88   * @}
89   */
90 
91 /* Private function prototypes -----------------------------------------------*/
92 
93 
94 /* Functions Definition ------------------------------------------------------*/
95 /** @addtogroup VENC_Exported_Functions
96   * @{
97   */
98 
99 /**
100   * @brief  Initialize the VENC hardware
101   * @note   to check that the initialization is correct, ASIC ID should be checked
102   * @retval None
103   */
LL_VENC_Init(void)104 void LL_VENC_Init(void)
105 {
106   /* make sure VENCRAM is allocated to VENC and not the system*/
107   assert_param(!LL_VENC_IS_VENCRAM_SYSTEM_ACCESSIBLE());
108 
109   /* enable APB5 bus clock*/
110   /* cf. errata : SHOULD ADD REFERENCE TO THE ERRATA */
111   /* using CMSIS access because ll_bus does not contain APB5 enable macros*/
112   WRITE_REG(RCC->BUSENSR, RCC_BUSENSR_APB5ENS);
113 
114   /* enable VENCRAM */
115   LL_MEM_EnableClock(LL_MEM_VENCRAM);
116 
117   /* enable VENC clock */
118   LL_APB5_GRP1_EnableClock(LL_APB5_GRP1_PERIPH_VENC);
119 }
120 
121 /**
122   * @brief  De-Initialize the VENC hardware
123   * @retval None
124   */
LL_VENC_DeInit(void)125 void LL_VENC_DeInit(void)
126 {
127   /* don't turn off APB5 in DeInit because other peripherals may be using it */
128 
129   /* disable VENCRAM */
130   LL_MEM_DisableClock(LL_MEM_VENCRAM);
131 
132   /* disable VENC clock */
133   LL_APB5_GRP1_DisableClock(LL_APB5_GRP1_PERIPH_VENC);
134 }
135 
136 /**
137   * @}
138   */
139 
140 /**
141   * @}
142   */
143 
144 #endif /* USE_VENC_MODULE */
145 
146 /**
147   * @}
148   */
149