1 /* 2 * Copyright (C) 2017-2024 Alibaba Group Holding Limited 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 /****************************************************************************** 20 * @file clk.c 21 * @brief CSI Source File for clk Driver 22 * @version V1.0 23 * @date 9. April 2020 24 ******************************************************************************/ 25 26 #include <stdint.h> 27 #include <soc.h> 28 #include <csi_core.h> 29 #include <csi_config.h> 30 #include <drv/common.h> 31 32 extern csi_clkmap_t clk_map[]; 33 csi_clk_enable(csi_dev_t * dev)34void csi_clk_enable(csi_dev_t *dev) 35 { 36 csi_clkmap_t *map = clk_map; 37 38 while (map->module != 0xFFFFFFFFU) { 39 if ((map->dev_tag == dev->dev_tag) && 40 (map->idx == dev->idx)) { 41 soc_clk_enable((clk_module_t)map->module); ///< TODO:打开时钟 42 break; 43 } 44 45 map++; 46 } 47 } 48 csi_clk_disable(csi_dev_t * dev)49void csi_clk_disable(csi_dev_t *dev) 50 { 51 csi_clkmap_t *map = clk_map; 52 53 while (map->module != 0xFFFFFFFFU) { 54 if ((map->dev_tag == dev->dev_tag) && 55 (map->idx == dev->idx)) { 56 soc_clk_disable((clk_module_t)map->module); ///< TODO:关闭时钟 57 break; 58 } 59 60 map++; 61 } 62 } 63