1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef _DRV_RSA_V1_H_ 20 #define _DRV_RSA_V1_H_ 21 22 #include "drv_osal_lib.h" 23 24 /* ************************** Internal Structure Definition *************************** */ 25 /* Define the offset of reg */ 26 #define REG_SEC_RSA_BUSY_REG 0x50 27 #define REG_SEC_RSA_MOD_REG 0x54 28 #define REG_SEC_RSA_WSEC_REG 0x58 29 #define REG_SEC_RSA_WDAT_REG 0x5c 30 #define REG_SEC_RSA_RPKT_REG 0x60 31 #define REG_SEC_RSA_RRSLT_REG 0x64 32 #define REG_SEC_RSA_START_REG 0x68 33 #define REG_SEC_RSA_ADDR_REG 0x6C 34 #define REG_SEC_RSA_ERROR_REG 0x70 35 #define REG_SEC_RSA_CRC16_REG 0x74 36 #define REG_SEC_RSA_KEY_RANDOM_1 0x7c 37 #define REG_SEC_RSA_INT_EN 0x80 38 #define REG_SEC_RSA_INT_STATUS 0x84 39 #define REG_SEC_RSA_INT_RAW 0x88 40 #define REG_SEC_RSA_INT_ERR_CLR 0x8c 41 #define REG_SEC_RSA_VERSION_ID 0x90 42 #define REG_SEC_RSA_KEY_RANDOM_2 0x94 43 44 #define RSA_INT_RAW_CLR 1 45 #define RSA_INT_ERR_CLR 1 46 47 /* Clear the RAM data of the stored result. */ 48 #define RSA_CLR_RAM_STORED_RESULT 1 49 50 /* Clear the RAM data of the stored message. */ 51 #define RSA_CLR_RAM_STORED_MSG 1 52 53 /* Clear the RAM data of the storage key. */ 54 #define RSA_CLR_RAM_STORED_KEY 1 55 56 /* Define the union sec_rsa_busy_reg */ 57 typedef union { 58 /* Define the struct bits */ 59 struct { 60 hi_u32 sec_rsa_busy_reg : 1; /* [0] */ 61 hi_u32 reserved_1 : 31; /* [31..1] */ 62 } bits; 63 64 /* Define an unsigned member */ 65 hi_u32 u32; 66 } sec_rsa_busy_reg; 67 68 /* Define the union sec_rsa_mod_reg */ 69 typedef union { 70 /* Define the struct bits */ 71 struct { 72 hi_u32 sec_rsa_mod_sel : 2; /* [1..0] */ 73 hi_u32 sec_rsa_key_width : 2; /* [3..2] */ 74 hi_u32 sec_rsa_data0_clr : 1; /* [4] */ 75 hi_u32 sec_rsa_data1_clr : 1; /* [5] */ 76 hi_u32 sec_rsa_data2_clr : 1; /* [6] */ 77 hi_u32 reserved_1 : 25; /* [31..7] */ 78 } bits; 79 80 /* Define an unsigned member */ 81 hi_u32 u32; 82 } sec_rsa_mod_reg; 83 84 /* Define the union sec_rsa_start_reg */ 85 typedef union { 86 /* Define the struct bits */ 87 struct { 88 hi_u32 sec_rsa_start_reg : 4; /* [3..0] */ 89 hi_u32 reserved_1 : 28; /* [31..4] */ 90 } bits; 91 92 /* Define an unsigned member */ 93 hi_u32 u32; 94 } sec_rsa_start_reg; 95 96 /* Define the union sec_rsa_int_en */ 97 typedef union { 98 /* Define the struct bits */ 99 struct { 100 hi_u32 rsa_int_en : 1; /* [0] */ 101 hi_u32 reserved_0 : 30; /* [30..1] */ 102 hi_u32 int_en : 1; /* [31] */ 103 } bits; 104 105 /* Define an unsigned member */ 106 hi_u32 u32; 107 } sec_rsa_int_en; 108 109 /* Define the union sec_rsa_int_status */ 110 typedef union { 111 /* Define the struct bits */ 112 struct { 113 hi_u32 rsa_int_status : 1; /* [0] */ 114 hi_u32 reserved_0 : 31; /* [31..1] */ 115 } bits; 116 117 /* Define an unsigned member */ 118 hi_u32 u32; 119 } sec_rsa_int_status; 120 121 /* Define the union sec_rsa_int_raw */ 122 typedef union { 123 /* Define the struct bits */ 124 struct { 125 hi_u32 rsa_int_raw : 1; /* [0] */ 126 hi_u32 reserved_0 : 31; /* [31..1] */ 127 } bits; 128 129 /* Define an unsigned member */ 130 hi_u32 u32; 131 } sec_rsa_int_raw; 132 #endif 133