/** * @file module_driver_pcc.h * @author Flagchip * @brief PCC driver type definition and API * @version 2.0.0 * @date 2024-08-20 * * SDK Version: 2.6.0 * * @copyright Copyright (c) 2024 Flagchip Semiconductors Co., Ltd. * */ /* ******************************************************************************** * Revision History: * * Version Date Initials CR# Descriptions * --------- ---------- ------------ ---------- --------------- * 0.1.0 2023-12-15 Flagchip055 N/A First version for FC7300 * 2.0.0 2024-10-12 Flagchip055 N/A Change version and release ******************************************************************************** */ #ifndef _DRIVER_MODULE_DRIVER_PCC_H_ #define _DRIVER_MODULE_DRIVER_PCC_H_ #include "device_header.h" #if PCC_INSTANCE_COUNT > 0U /** * @addtogroup module_driver_pcc * @{ */ /** * @name PCC API Service IDs * * @{ */ #define PCC_SET_PCC_ID 0x00U #define PCC_GET_PCC_INTERFACE_CLOCK_ID 0x01U #define PCC_GET_PCC_FUNCTION_CLOCK_ID 0x02U /** @}*/ /** * @name PCC Dev Error Code * @brief Error Code of calling PCC apis * * @{ */ #define PCC_E_PARAM_POINTER 0x01U #define PCC_E_PARAM_OUT_RANGE 0x02U /** @}*/ /** @brief Marco for PCCn Bit Field definition */ #define PCC_DWPLK_MASK 0x80000000u #define PCC_DWPLK_SHIFT 31u #define PCC_DWPLK_WIDTH 1u #define PCC_DWP_MASK 0x70000000u #define PCC_DWP_SHIFT 28u #define PCC_DWP_WIDTH 3u #define PCC_DWP(x) (((uint32_t)(((uint32_t)(x))<>PCC_SEL_SHIFT) #define PCC_DIV_MASK 0x7U #define PCC_DIV_SHIFT 0U #define PCC_DIV_WIDTH 3U #define PCC_DIV(x) (((uint32_t)(((uint32_t)(x))<>PCC_DIV_SHIFT) #define PCC_SWR_MASK 0x10000u #define PCC_MUX_MAX_NUMBER 8U /** * @brief Pcc clock status */ typedef enum { PCC_STATUS_SUCCESS = 0U, PCC_STATUS_CLOCK_INVALID = 1U, PCC_STATUS_CONFIGURED_NOT_SUPPORT = 1U, } PCC_StatusType; /** * @brief defined the clock source for function clock,match with PCC_XXX[SEL] bit filed. */ typedef enum { PCC_CLKGATE_SRC_OFF = 0U, PCC_CLKGATE_SRC_FOSCDIV = 1U, PCC_CLKGATE_SRC_SIRCDIV = 2U, PCC_CLKGATE_SRC_FIRCDIV = 3U, #if PCC_PLLX_CLK1_SUPPORT #if PCC_PLLX_CLK2_SUPPORT PCC_CLKGATE_SRC_PLL0CLK2 = 4U, #else PCC_CLKGATE_SRC_PLL1CLK1 = 4U, #endif /* PCC_PLLX_CLK2_SUPPORT */ #else PCC_CLKGATE_SRC_RESERVE0 = 4U, #endif /* PCC_PLLX_CLK1_SUPPORT */ #if PCC_PLL1_CLK_SUPPORT PCC_CLKGATE_SRC_PLL1DIV = 5U, #else PCC_CLKGATE_SRC_RESERVE1 = 5U, #endif /* PCC_PLL1_CLK_SUPPORT */ PCC_CLKGATE_SRC_PLL0DIV = 6U, #if PCC_PLLX_CLK1_SUPPORT PCC_CLKGATE_SRC_PLL0CLK1 = 7U #else PCC_CLKGATE_SRC_RESERVE2 = 7U #endif } PCC_ClkGateSrcType; /** * @brief define the clock divider,match with PCC_XXX[DIV] bit filed. */ typedef enum { PCC_CLK_DIV_BY1 = 0U, /*!< Divide by 1 (pass-through, no clock divide) */ PCC_CLK_DIV_BY2 = 1U, /*!< Divide by 2 */ PCC_CLK_DIV_BY3 = 2U, /*!< Divide by 3 */ PCC_CLK_DIV_BY4 = 3U, /*!< Divide by 4 */ PCC_CLK_DIV_BY5 = 4U, /*!< Divide by 5 */ PCC_CLK_DIV_BY6 = 5U, /*!< Divide by 6 */ PCC_CLK_DIV_BY7 = 6U, /*!< Divide by 7 */ PCC_CLK_DIV_BY8 = 7U, /*!< Divide by 8 */ PCC_CLK_UNINVOLVED = 8U /*!< Current peripheral dose not contain DIV configuration */ } PCC_ClkDivType; /** * @brief Indicate which CPU can control PCC */ typedef enum { PCC_CTRL_BY_ALL = 0U, /*!< All CPUs are allowed to write this peripheral */ PCC_CTRL_BY_CPU0 = 1U, /*!< Only CPU0 is allowed to control this peripheral */ PCC_CTRL_BY_CPU1 = 2U, /*!< Only CPU1 is allowed to control this peripheral */ PCC_CTRL_BY_CPU2 = 3U, /*!< Only CPU2 is allowed to control this peripheral */ PCC_CTRL_BY_NONE = 7U, /*! 0U */ #endif