summaryrefslogtreecommitdiff
path: root/bsp/CME_M7/StdPeriph_Driver/inc/cmem7_efuse.h
blob: e8a031f2470b85365c7533c3e101975f80f7ec90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/**
    *****************************************************************************
    * @file     cmem7_efuse.h
    *
    * @brief    CMEM7 EFUSE header file
    *
    *
    * @version  V1.0
    * @date     3. September 2013
    *
    * @note
    *
    *****************************************************************************
    * @attention
    *
    * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
    * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
    * TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
    * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
    * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
    * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
    *
    * <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
    *****************************************************************************
    */

#ifndef __CMEM7_EFUSE_H
#define __CMEM7_EFUSE_H

#ifdef __cplusplus
 extern "C" {
#endif

#include "cmem7.h"
#include "cmem7_conf.h"

/** @defgroup EFUSE_TMRF_R
  * @{
  */
#define EFUSE_TMRF_R_3000                0
#define EFUSE_TMRF_R_1200                1
#define EFUSE_TMRF_R_750                 2

#define IS_EFUSE_TMRF(R)                 (((R) == EFUSE_TMRF_R_3000) || \
                                          ((R) == EFUSE_TMRF_R_1200) || \
                                          ((R) == EFUSE_TMRF_R_750))
/**
  * @}
  */

/**
  * @brief  EFUSE timing structure
    */
typedef struct
{
    uint32_t EFUSE_Tpwph;                  /*!< Nano second                                    */
  uint32_t EFUSE_Trac;                   /*!< Nano second                                    */
    uint32_t EFUSE_Trah;                   /*!< Nano second                                    */
    uint32_t EFUSE_Trpw;                   /*!< Nano second                                    */
    uint32_t EFUSE_Trc;                    /*!< Nano second                                    */
    uint32_t EFUSE_Tesr;                   /*!< Nano second                                    */
    uint32_t EFUSE_Tprs;                   /*!< Nano second                                    */
    uint32_t EFUSE_Tpi;                    /*!< Nano second                                    */
    uint32_t EFUSE_Tpp;                    /*!< Nano second                                    */
    uint32_t EFUSE_Teps;                   /*!< Nano second                                    */
    uint32_t EFUSE_Tpwps;                  /*!< Nano second                                    */
} EFUSE_Timing;

/**
  * @brief  EFUSE initialization structure
    */
typedef struct
{
    uint8_t EFUSE_ClockDividor;              /*!< EFUSE clock dividor, 2 in n times */
    uint8_t EFUSE_TMRF;                    /*!< EFUSE reference resistor select, @ref EFUSE_TMRF_R */
  EFUSE_Timing* timing;                  /*!< Timing configuration, null if default           */
} EFUSE_InitTypeDef;

/**
  * @brief  EFUSE key structure
    */
typedef struct
{
    uint32_t key0;                         /*!< EFUSE AES key [31:0]                            */
  uint32_t key1;                         /*!< EFUSE AES key [63:32]                           */
    uint32_t key2;                         /*!< EFUSE AES key [95:64]                           */
    uint32_t key3;                         /*!< EFUSE AES key [127:96]                          */
    uint32_t key4;                         /*!< EFUSE AES key [159:128]                         */
  uint32_t key5;                         /*!< EFUSE AES key [191:160]                         */
    uint32_t key6;                         /*!< EFUSE AES key [223:192]                         */
    uint32_t key7;                         /*!< EFUSE AES key [255:224]                         */
} EFUSE_AesKey;

/**
  * @brief  EFUSE initialization
  * @note   This function should be called at first before any other interfaces.
    * @param[in] init A pointer to structure EFUSE_InitTypeDef
  * @retval None
    */
void EFUSE_Init(EFUSE_InitTypeDef* init);

/**
  * @brief  EFUSE initialization
  * @param[in] key A pointer to EFUSE_AesKey to be compared
  * @retval BOOL True if equal, or false if different
    */
BOOL EFUSE_Compare(EFUSE_AesKey* key);

#ifdef __cplusplus
}
#endif

#endif /* __CMEM7_EFUSE_H */