1 /*
2  * Copyright (c) 2020-2020, BLUETRUM Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "ab32vg1_hal.h"
8 
9 #ifdef HAL_RCU_MODULE_ENABLED
10 
hal_rcu_periph_clk_enable(uint32_t periph)11 void hal_rcu_periph_clk_enable(uint32_t periph)
12 {
13     if (periph <= RCU_TMR2) {
14         CLKGAT0 |= BIT(periph);
15     } else if (periph <= RCU_SPI1) {
16         CLKGAT1 |= BIT(periph - RCU_FMAMFDT);
17     }
18 }
19 
hal_rcu_periph_clk_disable(uint32_t periph)20 void hal_rcu_periph_clk_disable(uint32_t periph)
21 {
22     if (periph <= RCU_TMR2) {
23         CLKGAT0 &= ~BIT(periph);
24     } else if (periph <= RCU_SPI1) {
25         CLKGAT1 &= ~BIT(periph - RCU_FMAMFDT);
26     }
27 }
28 
29 #endif
30