Create access for w0w1

This commit is contained in:
Ben V. Brown
2022-06-21 18:25:38 +10:00
parent 6e062bfa59
commit 994f6d8381
2 changed files with 1049 additions and 1155 deletions

View File

@@ -36,8 +36,9 @@
#ifndef __BL702_EF_CTRL_H__
#define __BL702_EF_CTRL_H__
#include "ef_ctrl_reg.h"
#include "bl702_common.h"
#include "ef_ctrl_reg.h"
/** @addtogroup BL702_Peripheral_Driver
* @{
@@ -119,8 +120,7 @@ typedef enum {
/**
* @brief Efuse Ctrl secure configuration structure type definition
*/
typedef struct
{
typedef struct {
EF_Ctrl_Dbg_Mode_Type ef_dbg_mode; /*!< Efuse debug mode */
uint8_t ef_dbg_jtag_0_dis; /*!< Jtag debug disable config value */
uint8_t ef_sboot_en; /*!< Secure boot enable config value */
@@ -129,8 +129,7 @@ typedef struct
/**
* @brief Efuse analog RC32M trim type definition
*/
typedef struct
{
typedef struct {
uint32_t trimRc32mCodeFrExt : 8; /*!< Efuse analog trim:trim_rc32m_code_fr_ext */
uint32_t trimRc32mCodeFrExtParity : 1; /*!< Efuse analog trim:trim_rc32m_ext_code_en_parity */
uint32_t trimRc32mExtCodeEn : 1; /*!< Efuse analog trim:trim_rc32m_ext_code_en */
@@ -140,8 +139,7 @@ typedef struct
/**
* @brief Efuse analog RC32K trim type definition
*/
typedef struct
{
typedef struct {
uint32_t trimRc32kCodeFrExt : 10; /*!< Efuse analog trim:trim_rc32k_code_fr_ext */
uint32_t trimRc32kCodeFrExtParity : 1; /*!< Efuse analog trim:trim_rc32k_code_fr_ext_parity */
uint32_t trimRc32kExtCodeEn : 1; /*!< Efuse analog trim:trim_rc32k_ext_code_en */
@@ -151,8 +149,7 @@ typedef struct
/**
* @brief Efuse analog TSEN trim type definition
*/
typedef struct
{
typedef struct {
uint32_t tsenRefcodeCorner : 12; /*!< TSEN refcode */
uint32_t tsenRefcodeCornerParity : 1; /*!< TSEN refcode parity */
uint32_t tsenRefcodeCornerEn : 1; /*!< TSEN refcode enable */
@@ -163,8 +160,7 @@ typedef struct
/**
* @brief Efuse analog ADC Gain trim type definition
*/
typedef struct
{
typedef struct {
uint32_t adcGainCoeff : 12; /*!< ADC gain coeff */
uint32_t adcGainCoeffParity : 1; /*!< ADC gain coeff parity */
uint32_t adcGainCoeffEn : 1; /*!< ADC gain coeff enable */
@@ -174,8 +170,7 @@ typedef struct
/**
* @brief Efuse analog device info type definition
*/
typedef struct
{
typedef struct {
uint32_t rsvd_21_0 : 22; /*!< Reserved */
uint32_t sf_swap_cfg : 2; /*!< 0:swap none, 1:swap SF2_CS & SF2_IO2, 2:swap SF2_IO0 & SF2_IO3, 3:swap both */
uint32_t psram_cfg : 2; /*!< 0:no psram, 1:2MB psram, 2:external psram, 3:reserved */
@@ -187,8 +182,7 @@ typedef struct
/**
* @brief Efuse Capcode type definition
*/
typedef struct
{
typedef struct {
uint32_t capCode : 6; /*!< Cap code value */
uint32_t parity : 1; /*!< Parity of capcode */
uint32_t en : 1; /*!< Enable status */
@@ -204,53 +198,39 @@ typedef struct
/** @defgroup EF_CTRL_KEY_TYPE
* @{
*/
#define IS_EF_CTRL_KEY_TYPE(type) (((type) == EF_CTRL_KEY_SLOT0) || \
((type) == EF_CTRL_KEY_SLOT1) || \
((type) == EF_CTRL_KEY_SLOT2) || \
((type) == EF_CTRL_KEY_SLOT3) || \
((type) == EF_CTRL_KEY_SLOT4) || \
((type) == EF_CTRL_KEY_SLOT5) || \
((type) == EF_CTRL_KEY_MAX))
#define IS_EF_CTRL_KEY_TYPE(type) \
(((type) == EF_CTRL_KEY_SLOT0) || ((type) == EF_CTRL_KEY_SLOT1) || ((type) == EF_CTRL_KEY_SLOT2) || ((type) == EF_CTRL_KEY_SLOT3) || ((type) == EF_CTRL_KEY_SLOT4) || ((type) == EF_CTRL_KEY_SLOT5) \
|| ((type) == EF_CTRL_KEY_MAX))
/** @defgroup EF_CTRL_SIGN_TYPE
* @{
*/
#define IS_EF_CTRL_SIGN_TYPE(type) (((type) == EF_CTRL_SIGN_NONE) || \
((type) == EF_CTRL_SIGN_RSA) || \
((type) == EF_CTRL_SIGN_ECC))
#define IS_EF_CTRL_SIGN_TYPE(type) (((type) == EF_CTRL_SIGN_NONE) || ((type) == EF_CTRL_SIGN_RSA) || ((type) == EF_CTRL_SIGN_ECC))
/** @defgroup EF_CTRL_SF_AES_TYPE
* @{
*/
#define IS_EF_CTRL_SF_AES_TYPE(type) (((type) == EF_CTRL_SF_AES_NONE) || \
((type) == EF_CTRL_SF_AES_128) || \
((type) == EF_CTRL_SF_AES_192) || \
((type) == EF_CTRL_SF_AES_256))
#define IS_EF_CTRL_SF_AES_TYPE(type) (((type) == EF_CTRL_SF_AES_NONE) || ((type) == EF_CTRL_SF_AES_128) || ((type) == EF_CTRL_SF_AES_192) || ((type) == EF_CTRL_SF_AES_256))
/** @defgroup EF_CTRL_DBG_MODE_TYPE
* @{
*/
#define IS_EF_CTRL_DBG_MODE_TYPE(type) (((type) == EF_CTRL_DBG_OPEN) || \
((type) == EF_CTRL_DBG_PASSWORD) || \
((type) == EF_CTRL_DBG_CLOSE))
#define IS_EF_CTRL_DBG_MODE_TYPE(type) (((type) == EF_CTRL_DBG_OPEN) || ((type) == EF_CTRL_DBG_PASSWORD) || ((type) == EF_CTRL_DBG_CLOSE))
/** @defgroup EF_CTRL_CLK_TYPE
* @{
*/
#define IS_EF_CTRL_CLK_TYPE(type) (((type) == EF_CTRL_EF_CLK) || \
((type) == EF_CTRL_SAHB_CLK))
#define IS_EF_CTRL_CLK_TYPE(type) (((type) == EF_CTRL_EF_CLK) || ((type) == EF_CTRL_SAHB_CLK))
/** @defgroup EF_CTRL_CYC_PARA_TYPE
* @{
*/
#define IS_EF_CTRL_CYC_PARA_TYPE(type) (((type) == EF_CTRL_PARA_DFT) || \
((type) == EF_CTRL_PARA_MANUAL))
#define IS_EF_CTRL_CYC_PARA_TYPE(type) (((type) == EF_CTRL_PARA_DFT) || ((type) == EF_CTRL_PARA_MANUAL))
/** @defgroup EF_CTRL_OP_MODE_TYPE
* @{
*/
#define IS_EF_CTRL_OP_MODE_TYPE(type) (((type) == EF_CTRL_OP_MODE_AUTO) || \
((type) == EF_CTRL_OP_MODE_MANUAL))
#define IS_EF_CTRL_OP_MODE_TYPE(type) (((type) == EF_CTRL_OP_MODE_AUTO) || ((type) == EF_CTRL_OP_MODE_MANUAL))
/*@} end of group EF_CTRL_Public_Constants */
@@ -296,6 +276,7 @@ BL_Err_Type EF_Ctrl_Read_MAC_Address_Opt(uint8_t slot, uint8_t mac[8], uint8_t r
BL_Err_Type EF_Ctrl_Read_Chip_ID(uint8_t id[8]);
/*----------*/
BL_Err_Type EF_Ctrl_Get_Chip_PIDVID(uint16_t pid[1], uint16_t vid[1]);
uint64_t EF_Ctrl_Get_Key_Slot_w0w1();
BL_Err_Type EF_Ctrl_Get_Customer_PIDVID(uint16_t pid[1], uint16_t vid[1]);
/*----------*/
void EF_Ctrl_Read_Device_Info(Efuse_Device_Info_Type *deviceInfo);