/** * @file fc7xxx_driver_sec.h * @author Flagchip * @brief FC7xxx sec driver type definition and API * @version 0.2.0 * @date 2023-2-7 * * @copyright Copyright (c) 2023 Flagchip Semiconductors Co., Ltd. * * @details */ /******************************************************************************** * Revision History: * * Version Date Initials CR# Descriptions * --------- ---------- ------------ ---------- --------------- * 0.2.0 2023-2-7 Flagchip076 N/A First version for FC7300 ********************************************************************************/ #ifndef _DRIVER_SEC_H_ #define _DRIVER_SEC_H_ #include "HwA_sec.h" #include "device_header.h" /** * @addtogroup fc7xxx_driver_sec * @{ */ /** * @brief Debug Re-Enable Key * @note Only if four 32-bit writes match, it will set the DEN to 0x5 to enable debug and unlock SEC registers. The key is up to the user to decide in advance. * */ typedef struct { uint32_t Re_key0; /*!< The Debug Re-enable key 0*/ uint32_t Re_key1; /*!< The Debug Re-enable key 1*/ uint32_t Re_key2; /*!< The Debug Re-enable key 2*/ uint32_t Re_key3; /*!< The Debug Re-enable key 3*/ } ReEnDebug_Keys; typedef enum { SEC_STATUS_SUCCESS = 0U, /*!< SEC status success */ SEC_STATUS_FAILED = 1U /*!< SEC status failed */ }SEC_RetType; /** * @brief NVR write and read Permissions. * @*/ typedef struct { bool WritEn; /*!< The NVR write permission*/ bool ReadEn; /*!< The NVR read permission*/ bool EraseEn; /*!< The NVR Erase permission*/ } NVR_Per; /** * @brief Indicate the system state * * */ typedef enum { Securedstate = 0u, /*!< The system is in secured state*/ UnSecuredstate = 1u /*!< The system is in no secured state*/ } Systemstate; /** * @brief Indicate the ISP instance * * */ typedef enum { ISP_FCUART1 = 0U, /*!< The ISP instance is FCUART1 */ ISP_FCUART3 = 1U, /*!< The ISP instance is FCUART3 */ ISP_FLEXCAN1 = 2U, /*!< The ISP instance is FLEXCAN1 */ ISP_FLEXCAN5 = 3U /*!< The ISP instance is FLEXCAN3 */ }Isp_Instance; /** * @brief Indicate the FCUART Baud Rate for ISP * * */ typedef enum { ISP_FCUART_2MBPS =0u, /*!< the FCUART Baud Rate is 2Mbps*/ ISP_FCUART_1MBPS =1u, /*!< the FCUART Baud Rate is 1Mbps*/ ISP_FCUART_512KBPS =2u, /*!< the FCUART Baud Rate is 512kbps*/ ISP_FCUART_115200BPS =3u, /*!< the FCUART Baud Rate is 115200bps*/ ISP_FCUART_INVALID = 4u /*!< the ISP instance is not FCUART*/ }FCUART_ISP_BAUDRATE; /** * @brief Indicate the FLEXCAN Baud Rate for ISP * * */ typedef enum { ISP_FLEXCANFD_4MBPS =0u, /*!< the CANFD Baud Rate is 4Mbps*/ ISP_FLEXCANFD_2MBPS =1u, /*!< the CANFD Baud Rate is 2Mbps*/ ISP_FLEXCAN_1MBPS =2u, /*!< the CAN Baud Rate is 1Mbps*/ ISP_FLEXCAN_500kBPS =3u, /*!< the FCUART Baud Rate is 500kbps*/ ISP_FLEXCAN_INVALID = 4u /*!< the ISP instance is not FLEXCAN*/ }FLEXCAN_ISP_BAUDRATE; /** * @brief Indicate the ISP information. * * */ typedef struct { bool IspModeEn; /*!< true means - ISP mode is active.*/ bool IspPinEn; /*!< true means - ISP pin is active.The associated pin defaults to internal pull up enabled.*/ bool IspAuthEn; /*!<*true means - ISP Auth Enable. Only valid in secure boot. (Value loaded from NVR sector)*/ Isp_Instance Ispinstance; /*!< the Isp instance*/ FCUART_ISP_BAUDRATE Ispfcuartbaudrate; /*!< Indicate the FCUART Baud Rate for ISP*/ FLEXCAN_ISP_BAUDRATE Ispflexcanbaudrate; /*!< Indicate the FLEXCAN Baud Rate for ISP*/ }SEC_IspInfo; /** * @brief Indicate the fast boot speed. * * */ typedef enum { FASTBOOT_300MHZ = 0u, /*!< Select PLL0 as the core clock source; the core clock is 300MHz.*/ FASTBOOT_96MHZ = 1u /*!< Select FIRC as the core clock source; the core clock is 96MHz.*/ }FastBoot_Speed; /** * @brief Indicate the OSC Frequency * * */ typedef enum { OSC_8MHZ = 0u, /*!