|
| 1 | +/******************************************************************************* |
| 2 | +* File Name: cycfg_clocks.c |
| 3 | +* |
| 4 | +* Description: |
| 5 | +* Clock configuration |
| 6 | +* This file was automatically generated and should not be modified. |
| 7 | +* |
| 8 | +******************************************************************************** |
| 9 | +* Copyright 2017-2019 Cypress Semiconductor Corporation |
| 10 | +* SPDX-License-Identifier: Apache-2.0 |
| 11 | +* |
| 12 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 13 | +* you may not use this file except in compliance with the License. |
| 14 | +* You may obtain a copy of the License at |
| 15 | +* |
| 16 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 17 | +* |
| 18 | +* Unless required by applicable law or agreed to in writing, software |
| 19 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 20 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 21 | +* See the License for the specific language governing permissions and |
| 22 | +* limitations under the License. |
| 23 | +********************************************************************************/ |
| 24 | + |
| 25 | +#include "cycfg_clocks.h" |
| 26 | + |
| 27 | +#if defined (CY_USING_HAL) |
| 28 | + const cyhal_resource_inst_t CYBSP_USB_CLK_DIV_obj = |
| 29 | + { |
| 30 | + .type = CYHAL_RSC_CLOCK, |
| 31 | + .block_num = CYBSP_USB_CLK_DIV_HW, |
| 32 | + .channel_num = CYBSP_USB_CLK_DIV_NUM, |
| 33 | + }; |
| 34 | +#endif //defined (CY_USING_HAL) |
| 35 | +#if defined (CY_USING_HAL) |
| 36 | + const cyhal_resource_inst_t CYBSP_CSD_COMM_CLK_DIV_obj = |
| 37 | + { |
| 38 | + .type = CYHAL_RSC_CLOCK, |
| 39 | + .block_num = CYBSP_CSD_COMM_CLK_DIV_HW, |
| 40 | + .channel_num = CYBSP_CSD_COMM_CLK_DIV_NUM, |
| 41 | + }; |
| 42 | +#endif //defined (CY_USING_HAL) |
| 43 | +#if defined (CY_USING_HAL) |
| 44 | + const cyhal_resource_inst_t CYBSP_CSD_CLK_DIV_obj = |
| 45 | + { |
| 46 | + .type = CYHAL_RSC_CLOCK, |
| 47 | + .block_num = CYBSP_CSD_CLK_DIV_HW, |
| 48 | + .channel_num = CYBSP_CSD_CLK_DIV_NUM, |
| 49 | + }; |
| 50 | +#endif //defined (CY_USING_HAL) |
| 51 | +#if defined (CY_USING_HAL) |
| 52 | + const cyhal_resource_inst_t CYBSP_BT_UART_CLK_DIV_obj = |
| 53 | + { |
| 54 | + .type = CYHAL_RSC_CLOCK, |
| 55 | + .block_num = CYBSP_BT_UART_CLK_DIV_HW, |
| 56 | + .channel_num = CYBSP_BT_UART_CLK_DIV_NUM, |
| 57 | + }; |
| 58 | +#endif //defined (CY_USING_HAL) |
| 59 | + |
| 60 | + |
| 61 | +void init_cycfg_clocks(void) |
| 62 | +{ |
| 63 | + Cy_SysClk_PeriphDisableDivider(CY_SYSCLK_DIV_16_BIT, 0U); |
| 64 | + Cy_SysClk_PeriphSetDivider(CY_SYSCLK_DIV_16_BIT, 0U, 999U); |
| 65 | + Cy_SysClk_PeriphEnableDivider(CY_SYSCLK_DIV_16_BIT, 0U); |
| 66 | +#if defined (CY_USING_HAL) |
| 67 | + cyhal_hwmgr_reserve(&CYBSP_USB_CLK_DIV_obj); |
| 68 | +#endif //defined (CY_USING_HAL) |
| 69 | + |
| 70 | + Cy_SysClk_PeriphDisableDivider(CY_SYSCLK_DIV_8_BIT, 1U); |
| 71 | + Cy_SysClk_PeriphSetDivider(CY_SYSCLK_DIV_8_BIT, 1U, 7U); |
| 72 | + Cy_SysClk_PeriphEnableDivider(CY_SYSCLK_DIV_8_BIT, 1U); |
| 73 | +#if defined (CY_USING_HAL) |
| 74 | + cyhal_hwmgr_reserve(&CYBSP_CSD_COMM_CLK_DIV_obj); |
| 75 | +#endif //defined (CY_USING_HAL) |
| 76 | + |
| 77 | + Cy_SysClk_PeriphDisableDivider(CY_SYSCLK_DIV_8_BIT, 3U); |
| 78 | + Cy_SysClk_PeriphSetDivider(CY_SYSCLK_DIV_8_BIT, 3U, 255U); |
| 79 | + Cy_SysClk_PeriphEnableDivider(CY_SYSCLK_DIV_8_BIT, 3U); |
| 80 | +#if defined (CY_USING_HAL) |
| 81 | + cyhal_hwmgr_reserve(&CYBSP_CSD_CLK_DIV_obj); |
| 82 | +#endif //defined (CY_USING_HAL) |
| 83 | + |
| 84 | + Cy_SysClk_PeriphDisableDivider(CY_SYSCLK_DIV_8_BIT, 4U); |
| 85 | + Cy_SysClk_PeriphSetDivider(CY_SYSCLK_DIV_8_BIT, 4U, 108U); |
| 86 | + Cy_SysClk_PeriphEnableDivider(CY_SYSCLK_DIV_8_BIT, 4U); |
| 87 | +#if defined (CY_USING_HAL) |
| 88 | + cyhal_hwmgr_reserve(&CYBSP_BT_UART_CLK_DIV_obj); |
| 89 | +#endif //defined (CY_USING_HAL) |
| 90 | +} |
0 commit comments