1 /** 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * 15 * Description: Provides V150 i2c register \n 16 * 17 * History: \n 18 * 2023-03-06, Create file. \n 19 */ 20 21 #ifndef HAL_I2C_V150_REGS_DEF_H 22 #define HAL_I2C_V150_REGS_DEF_H 23 24 #include <stdint.h> 25 26 #ifdef __cplusplus 27 #if __cplusplus 28 extern "C" { 29 #endif /* __cplusplus */ 30 #endif /* __cplusplus */ 31 32 /** 33 * @defgroup drivers_hal_i2c_v150_regs_def I2C V150 Regs Definition 34 * @ingroup drivers_hal_i2c 35 * @{ 36 */ 37 38 /* I2C寄存器默认值定义 */ 39 #define I2C_CTRL_DEFAULT_VAL 0x0 40 #define I2C_COM_DEFAULT_VAL 0x0 41 #define I2C_ICR_DEFAULT_VAL 0x0 42 #define I2C_SR_DEFAULT_VAL 0x0 43 #define I2C_SCL_H_DEFAULT_VAL 0x0 44 #define I2C_SCL_L_DEFAULT_VAL 0x0 45 #define I2C_TXR_DEFAULT_VAL 0x0 46 #define I2C_RXR_DEFAULT_VAL 0x0 47 #define I2C_FIFOSTATUS_DEFAULT_VAL 0x0 48 #define I2C_TXCOUNT_DEFAULT_VAL 0x0 49 #define I2C_RXCOUNT_DEFAULT_VAL 0x0 50 #define I2C_RXTIDE_DEFAULT_VAL 0x1 51 #define I2C_TXTIDE_DEFAULT_VAL 0x1 52 #define I2C_FTRPER_DEFAULT_VAL 0xF 53 54 /** 55 * @if Eng 56 * @brief This union represents the bit fields in I2C_CTRL Register. 57 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 58 * I2C control register, used to configure the I2C enable and interrupt mask. 59 * @else 60 * @brief I2C_CTRL 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 61 * I2C控制寄存器, 用于配置I2C使能和中断屏蔽。 62 * @endif 63 */ 64 typedef union i2c_ctrl_data { 65 uint32_t d32; /*!< 寄存器实际数据 */ 66 struct { 67 uint32_t int_done_mask : 1; /*!< bit[0] 68 总线传输完成中断屏蔽。 69 0: 屏蔽 70 1: 不屏蔽 */ 71 uint32_t int_arb_loss_mask : 1; /*!< bit[1] 72 总线仲裁失败中断屏蔽。 73 0: 屏蔽 74 1: 不屏蔽 */ 75 uint32_t int_ack_err_mask : 1; /*!< bit[2] 76 从机ACK错误中断屏蔽。 77 0: 屏蔽 78 1: 不屏蔽 */ 79 uint32_t int_rx_mask : 1; /*!< bit[3] 80 主机接收中断屏蔽。 81 0: 屏蔽 82 1: 不屏蔽 */ 83 uint32_t int_tx_mask : 1; /*!< bit[4] 84 主机发送中断屏蔽。 85 0: 屏蔽 86 1: 不屏蔽 */ 87 uint32_t int_stop_mask : 1; /*!< bit[5] 88 主机停止条件发送结束中断屏蔽。 89 0: 屏蔽 90 1: 不屏蔽 */ 91 uint32_t int_start_mask : 1; /*!< bit[6] 92 主机开始条件发送结束中断屏蔽。 93 0: 屏蔽 94 1: 不屏蔽 */ 95 uint32_t int_mask : 1; /*!< bit[7] 96 I2C中断总屏蔽。 97 0: 屏蔽 98 1: 不屏蔽 */ 99 uint32_t i2c_en : 1; /*!< bit[8] 100 I2C使能。 101 0: 不使能 102 1: 使能 */ 103 uint32_t int_rxtide_mask : 1; /*!< bit[9] 104 发送FIFO溢出中断屏蔽。 105 0: 屏蔽 106 1: 不屏蔽 */ 107 uint32_t int_txtide_mask : 1; /*!< bit[10] 108 发送FIFO溢出中断屏蔽。 109 0: 屏蔽 110 1: 不屏蔽 */ 111 uint32_t mode_ctrl : 1; /*!< bit[11] 112 I2C工作模式选择。 113 0: 不使用FIFO传输模式 114 1: 使用FIFO传输模式 */ 115 uint32_t int_txfifo_over_mask : 1; /*!< bit[12] 116 发送FIFO数据发送完成中断屏蔽。 117 0: 屏蔽 118 1: 不屏蔽 */ 119 uint32_t reserved13_31 : 19; /*!< bit[13:31] 保留位 */ 120 } b; /*!< Register bits. */ 121 } i2c_ctrl_data_t; 122 123 /** 124 * @if Eng 125 * @brief This union represents the bit fields in I2C_COM Register. 126 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 127 * I2C command register, used to configure work operation of I2C module. 128 * Corresponding interrupt status should be cleared before or duration I2C initialization. 129 * I2C_COM bit[3:0] is automatically cleared after the operation is complete. 130 * @else 131 * @brief I2C_COM 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 132 * I2C模块的命令寄存器, 用于配置I2C模块工作时命令。 133 * 在系统初始化时配置或配置前, 需要清除对应中断标志, I2C_COM bit[3:0]在操作结束后将自动清0。 134 * @endif 135 */ 136 typedef union i2c_com_data { 137 uint32_t d32; /*!< 寄存器实际数据 */ 138 struct { 139 uint32_t op_stop : 1; /*!< bit[0] 140 产生停止条件操作。 141 0: 操作结束。 142 1: 操作有效。 */ 143 uint32_t op_we : 1; /*!< bit[1] 144 产生写操作。 145 0: 操作结束。 146 1: 操作有效。 */ 147 uint32_t op_rd : 1; /*!< bit[2] 148 产生读操作。 149 0: 操作结束。 150 1: 操作有效。 */ 151 uint32_t op_start : 1; /*!< bit[3] 152 产生开始条件操作; 153 0: 操作结束。 154 1: 操作有效。 */ 155 uint32_t op_ack : 1; /*!< bit[4] 156 主机作为接收器是否发送ACK。 157 0: 发送。 158 1: 不发送。 */ 159 uint32_t reserved5_31 : 27; /*!< bit[5:31] 保留位 */ 160 } b; /*!< 寄存器比特位 */ 161 } i2c_com_data_t; 162 163 /** 164 * @if Eng 165 * @brief This union represents the bit fields in I2C_ICR Register. 166 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 167 * I2C interrupt status clear register, used to clear interrupt status. 168 * Corresponding bit will be set to 0 when new interrupt rised. 169 * @else 170 * @brief I2C_ICR 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 171 * I2C模块的中断清除寄存器。 172 * 新中断到来时, I2C模块会自动将I2C_ICR相应位清0。 173 * @endif 174 */ 175 typedef union i2c_icr_data { 176 uint32_t d32; /*!< 寄存器实际数据 */ 177 struct { 178 uint32_t clr_int_done : 1; /*!< bit[0] 179 总线传输完成中断标志清除。 180 0: 不清除 181 1: 清除 */ 182 uint32_t clr_int_arb_loss : 1; /*!< bit[1] 183 总线仲裁失败中断标志清除。 184 0: 不清除 185 1: 清除 */ 186 uint32_t clr_int_ack_err : 1; /*!< bit[2] 187 从机ACK错误中断标志清除。 188 0: 不清除 189 1: 清除 */ 190 uint32_t clr_int_rx : 1; /*!< bit[3] 191 主机接收中断标志清除。 192 0: 不清除 193 1: 清除 */ 194 uint32_t clr_int_tx : 1; /*!< bit[4] 195 主机发送中断标志清除。 196 0: 不清除 197 1: 清除 */ 198 uint32_t clr_int_stop : 1; /*!< bit[5] 199 主机停止条件发送结束中断标志清除。 200 0: 不清除 201 1: 清除 */ 202 uint32_t clr_int_start : 1; /*!< bit[6] 203 主机开始条件发送结束中断标志清除。 204 0: 不清除 205 1: 清除 */ 206 uint32_t clr_int_rxtide : 1; /*!< bit[7] 207 接收FIFO溢出中断标志清除。 208 0: 不清除 209 1: 清除 */ 210 uint32_t clr_int_txtide : 1; /*!< bit[8] 211 发送FIFO溢出中断标志清除。 212 0: 不清除 213 1: 清除 */ 214 uint32_t clr_int_txfifo_over : 1; /*!< bit[9] 215 发送FIFO数据发送完成中断标志清除。 216 0: 不清除 217 1: 清除 */ 218 uint32_t reserved10_31 : 22; /*!< bit[10:31] 保留位 */ 219 } b; /*!< 寄存器比特位 */ 220 } i2c_icr_data_t; 221 222 /** 223 * @if Eng 224 * @brief This union represents the bit fields in I2C_SR Register. 225 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 226 * I2C status register, used to get work status of I2C module. 227 * I2C_SR bit[1] indicates I2C arbitrate failed, when this bit enabled, the last operation is failed. 228 * We should clear other interrupt flags before clear bit[1], then we clear I2C_COM or write new operation 229 * to I2C_COM, finally we can clear I2C_SR bit[1]. 230 * @else 231 * @brief I2C_SR 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 232 * I2C模块状态寄存器, 用于读取I2C模块工作状态。 233 * I2C_SR bit[1]表示I2C总线仲裁失败, 当I2C_SR bit[1]有效时, 当前操作失败, 在清I2C_SR bit[1]之前, 234 * 需要清除其他中断标志, 然后清除I2C_COM或向I2C_COM写入新的操作命令, 最后清除I2C_SR bit[1]。 235 * @endif 236 */ 237 typedef union i2c_sr_data { 238 uint32_t d32; /*!< 寄存器实际数据 */ 239 struct { 240 uint32_t int_done : 1; /*!< bit[0] 241 总线传输完成中断标志。 242 0: 无中断标志产生 243 1: 中断标志产生 */ 244 uint32_t int_arb_loss : 1; /*!< bit[1] 245 总线仲裁失败中断标志。 246 0: 无中断标志产生 247 1: 中断标志产生 */ 248 uint32_t int_ack_err : 1; /*!< bit[2] 249 从机ACK错误中断标志。 250 0: 无中断标志产生 251 1: 中断标志产生 */ 252 uint32_t int_rx : 1; /*!< bit[3] 253 主机接收中断标志。 254 0: 无中断标志产生 255 1: 中断标志产生 */ 256 uint32_t int_tx : 1; /*!< bit[4] 257 主机发送中断标志。 258 0: 无中断标志产生 259 1: 中断标志产生 */ 260 uint32_t int_stop : 1; /*!< bit[5] 261 主机停止条件发送结束中断标志。 262 0: 无中断标志产生 263 1: 中断标志产生 */ 264 uint32_t int_start : 1; /*!< bit[6] 265 主机开始条件发送结束中断标志。 266 0: 无中断标志产生 267 1: 中断标志产生 */ 268 uint32_t bus_busy : 1; /*!< bit[7] 269 总线忙。 270 0: 空闲 271 1: 忙 */ 272 uint32_t int_rxtide : 1; /*!< bit[8] 273 接收FIFO溢出中断标志。 274 0: 无中断标志产生 275 1: 中断标志产生 */ 276 uint32_t int_txtide : 1; /*!< bit[9] 277 发送FIFO溢出中断标志。 278 0: 无中断标志产生 279 1: 中断标志产生 */ 280 uint32_t int_txfifo_over : 1; /*!< bit[10] 281 发送FIFO数据发送完成中断标志。 282 0: 无中断标志产生 283 1: 中断标志产生 */ 284 uint32_t reserved11_31 : 21; /*!< bit[11:31] 保留位 */ 285 } b; /*!< 寄存器比特位 */ 286 } i2c_sr_data_t; 287 288 /** 289 * @if Eng 290 * @brief This union represents the bit fields in I2C_SCL_H Register. 291 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 292 * I2C serial clock high register, used to set number of clock high-level cycles. 293 * I2C_SCL_H should be configed in I2C initialization or after setting I2C_CTRL bit[7] to 0. 294 * @else 295 * @brief I2C_SCL_H 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 296 * I2C总线SCL信号高电平周期数寄存器, 用于配置I2C模块工作时SCL高电平周期数。 297 * 在系统初始化时配置或配置前使I2C_CTRL bit[7]=0。 298 * @endif 299 */ 300 typedef union i2c_scl_h_data { 301 uint32_t d32; /*!< 寄存器实际数据 */ 302 struct { 303 uint32_t scl_h : 16; /*!< bit[0:15] 304 配置数值乘2等于SCL高电平周期数。 */ 305 uint32_t reserved16_31 : 16; /*!< bit[16:31] 保留位 */ 306 } b; /*!< 寄存器比特位 */ 307 } i2c_scl_h_data_t; 308 309 /** 310 * @if Eng 311 * @brief This union represents the bit fields in I2C_SCL_L Register. 312 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 313 * I2C serial clock low register, used to set number of clock low-level cycles. 314 * I2C_SCL_L should be configed in I2C initialization or after setting I2C_CTRL bit[7] to 0. 315 * @else 316 * @brief I2C_SCL_L 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 317 * I2C总线SCL信号低电平周期数寄存器, 用于配置I2C模块工作时SCL低电平周期数。 318 * 在系统初始化时配置或配置前使I2C_CTRL bit[7]=0。 319 * @endif 320 */ 321 typedef union i2c_scl_l_data { 322 uint32_t d32; /*!< 寄存器实际数据 */ 323 struct { 324 uint32_t scl_l : 16; /*!< bit[0:15] 325 配置数值乘2等于SCL底电平周期数。 */ 326 uint32_t reserved16_31 : 16; /*!< bit[16:31] 保留位 */ 327 } b; /*!< 寄存器比特位 */ 328 } i2c_scl_l_data_t; 329 330 /** 331 * @if Eng 332 * @brief This union represents the bit fields in I2C_TXR Register. 333 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 334 * I2C tx data register, used to set data to send. 335 * When FIFO disabled, value of I2C_TXR will not be changed after transmission. 336 * When FIFO enabled, data writen to this reg will be load into fifo automatically 337 * until transmission finished. 338 * @else 339 * @brief I2C_TXR 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 340 * I2C发送数据寄存器, 用于配置I2C模块工作时发送数据。 341 * 不使用FIFO模式下, 发送结束后, I2C模块不会修改I2C_TXR内容。 342 * 使用FIFO模式下, 写入的数据会自动载入到发送FIFO中保存直到该数据发送结束。 343 * @endif 344 */ 345 typedef union i2c_txr_data { 346 uint32_t d32; /*!< 寄存器实际数据 */ 347 struct { 348 uint32_t i2c_txr : 8; /*!< bit[0:7] 349 主机发送数据。 */ 350 uint32_t reserved8_31 : 24; /*!< bit[8:31] 保留位 */ 351 } b; /*!< 寄存器比特位 */ 352 } i2c_txr_data_t; 353 354 /** 355 * @if Eng 356 * @brief This union represents the bit fields in I2C_RXR Register. 357 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 358 * I2C rx data register, used to get data received. 359 * When FIFO disabled, data in I2C_RXR is valid when I2C_SR bit[3]=1. 360 * When FIFO enabled, read I2C_RXR directly fetches data from RX FIFO. 361 * @else 362 * @brief I2C_RXR 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 363 * I2C接收数据寄存器, 用于主机接收从机数据。 364 * 不使用FIFO模式下, I2C_RXR数据在I2C_SR bit[3]=1时, 数据有效, 同时数据将保持到下一个读操作前。 365 * 使用FIFO模式下, 读取I2C_RXR会直接从接收FIFO中取数据。 366 * @endif 367 */ 368 typedef union i2c_rxr_data { 369 uint32_t d32; /*!< 寄存器实际数据 */ 370 struct { 371 uint32_t i2c_rxr : 8; /*!< bit[0:7] 372 主机接收数据。 */ 373 uint32_t reserved8_31 : 24; /*!< bit[8:31] 保留位 */ 374 } b; /*!< 寄存器比特位 */ 375 } i2c_rxr_data_t; 376 377 /** 378 * @if Eng 379 * @brief This union represents the bit fields in I2C_FIFOSTATUS Register. 380 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 381 * I2C FIFO status register, used to get fifo status. 382 * @else 383 * @brief I2C_FIFOSTATUS 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 384 * FIFO状态寄存器。 385 * @endif 386 */ 387 typedef union i2c_fifostatus_data { 388 uint32_t d32; /*!< 寄存器实际数据 */ 389 struct { 390 uint32_t txff : 1; /*!< bit[0] 391 发送FIFO满状态。 392 0: 未满 393 1: 满 */ 394 uint32_t txfe : 1; /*!< bit[1] 395 发送FIFO空状态。 396 0: 非空 397 1: 空 */ 398 uint32_t rxff : 1; /*!< bit[2] 399 接收FIFO满状态。 400 0: 未满 401 1: 满 */ 402 uint32_t rxfe : 1; /*!< bit[3] 403 接收FIFO空状态。 404 0: 非空 405 1: 空 */ 406 uint32_t reserved4_31 : 28; /*!< bit[4:31] 保留位 */ 407 } b; /*!< 寄存器比特位 */ 408 } i2c_fifostatus_data_t; 409 410 /** 411 * @if Eng 412 * @brief This union represents the bit fields in I2C_TXCOUNT Register. 413 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 414 * I2C tx data cnt register. 415 * @else 416 * @brief I2C_TXCOUNT 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 417 * 发送FIFO数据个数寄存器。 418 * @endif 419 */ 420 typedef union i2c_txcount_data { 421 uint32_t d32; /*!< 寄存器实际数据 */ 422 struct { 423 uint32_t txcount : 6; /*!< bit[0:5] 424 读该寄存器返回发送FIFO中的字符数。 425 写该寄存器(任意值)将清空发送FIFO。 */ 426 uint32_t reserved6_31 : 26; /*!< bit[6:31] 保留位 */ 427 } b; /*!< 寄存器比特位 */ 428 } i2c_txcount_data_t; 429 430 /** 431 * @if Eng 432 * @brief This union represents the bit fields in I2C_RXCOUNT Register. 433 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 434 * I2C rx data cnt register. 435 * @else 436 * @brief I2C_RXCOUNT 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 437 * 接收FIFO数据个数寄存器。 438 * @endif 439 */ 440 typedef union i2c_rxcount_data { 441 uint32_t d32; /*!< 寄存器实际数据 */ 442 struct { 443 uint32_t rxcount : 6; /*!< bit[0:5] 444 读该寄存器返回接收FIFO中的字符数。 445 写该寄存器(任意值)将清空接收FIFO。 */ 446 uint32_t reserved6_31 : 26; /*!< bit[6:31] 保留位 */ 447 } b; /*!< 寄存器比特位 */ 448 } i2c_rxcount_data_t; 449 450 /** 451 * @if Eng 452 * @brief This union represents the bit fields in I2C_RXTIDE Register. 453 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 454 * I2C rx fifo overflow thershold register. 455 * @else 456 * @brief I2C_RXTIDE 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 457 * 接收FIFO的溢出阈值寄存器。 458 * @endif 459 */ 460 typedef union i2c_rxtide_data { 461 uint32_t d32; /*!< 寄存器实际数据 */ 462 struct { 463 uint32_t rxtide : 6; /*!< bit[0:5] 464 设置int_rxtide中断的触发值。 465 当 RX_FIFO中的字符个数 ≥ I2C_RXTIDE[rxtide] 时 466 会触发接收FIFO溢出中断。 */ 467 uint32_t reserved6_31 : 26; /*!< bit[6:31] 保留位 */ 468 } b; /*!< 寄存器比特位 */ 469 } i2c_rxtide_data_t; 470 471 /** 472 * @if Eng 473 * @brief This union represents the bit fields in I2C_TXTIDE Register. 474 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 475 * I2C tx fifo overflow thershold register. Data in TXFIFO will be removed only after successful tx. 476 * @else 477 * @brief I2C_TXTIDE 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 478 * 接收FIFO的溢出阈值寄存器。 479 * TXFIFO中的字符只有在成功发送后才会被移除。 480 * @endif 481 */ 482 typedef union i2c_txtide_data { 483 uint32_t d32; /*!< 寄存器实际数据 */ 484 struct { 485 uint32_t txtide : 6; /*!< bit[0:5] 486 设置int_txtide中断的触发值。 487 当 TX_FIFO中的字符个数 ≤ I2C_TXTIDE[txtide] 时 488 会触发发送FIFO溢出中断。 */ 489 uint32_t reserved6_31 : 26; /*!< bit[6:31] 保留位 */ 490 } b; /*!< 寄存器比特位 */ 491 } i2c_txtide_data_t; 492 493 /** 494 * @if Eng 495 * @brief This union represents the bit fields in I2C_FTRPER Register. 496 * Read the register into the <i>d32</i> member then set/clear the bits using the <i>b</i> elements. 497 * I2C glitch filtering cycles number register. 498 * Determine high-level duration of sda signal, unit is the number of ic_clk cycles. 499 * Signal be regard as receive data when duration is longer than this number. 500 * @else 501 * @brief I2C_FTRPER 寄存器联合体定义, 通过<i>d32</i>成员读取寄存器值, 通过<i>b</i>成员设置比特位。 502 * 毛刺过滤寄存器。 503 * scl为高时,判断sda电平持续时间,单位为ic_clk的时钟个数,持续时间大于该值才认为该电平为接收值。 504 * @endif 505 */ 506 typedef union i2c_ftrper_data { 507 uint32_t d32; /*!< 寄存器实际数据 */ 508 struct { 509 uint32_t ftrper : 4; /*!< bit[0:3] 510 默认15个时钟周期, 需要SDA需要再SCL为高时, 电平保持的时间。 */ 511 uint32_t reserved4_31 : 28; /*!< bit[6:31] 保留位 */ 512 } b; /*!< 寄存器比特位 */ 513 } i2c_ftrper_data_t; 514 515 /** 516 * @if Eng 517 * @brief I2C registers. 518 * @else 519 * @brief I2C相关寄存器。 520 * @endif 521 */ 522 typedef struct i2c_regs { 523 volatile uint32_t i2c_ctrl; /*!< I2C控制寄存器 <i>Offset: 0x00</i>. */ 524 volatile uint32_t i2c_com; /*!< I2C命令寄存器 <i>Offset: 0x04</i>. */ 525 volatile uint32_t i2c_icr; /*!< I2C中断清除寄存器 <i>Offset: 0x08</i>. */ 526 volatile uint32_t i2c_sr; /*!< I2C状态寄存器 <i>Offset: 0x0C</i>. */ 527 volatile uint32_t i2c_scl_h; /*!< I2C总线SCL信号高电平周期数寄存器 <i>Offset: 0x10</i>. */ 528 volatile uint32_t i2c_scl_l; /*!< I2C总线SCL信号低电平周期数寄存器 <i>Offset: 0x14</i>. */ 529 volatile uint32_t i2c_txr; /*!< I2C发送数据寄存器 <i>Offset: 0x18</i>. */ 530 volatile uint32_t i2c_rxr; /*!< I2C接收数据寄存器 <i>Offset: 0x1C</i>. */ 531 volatile uint32_t i2c_fifostatus; /*!< FIFO状态寄存器 <i>Offset: 0x20</i>. */ 532 volatile uint32_t i2c_txcount; /*!< 发送FIFO数据个数寄存器 <i>Offset: 0x24</i>. */ 533 volatile uint32_t i2c_rxcount; /*!< 接收FIFO数据个数寄存器 <i>Offset: 0x28</i>. */ 534 volatile uint32_t i2c_rxtide; /*!< 接收FIFO的溢出阈值寄存器 <i>Offset: 0x2C</i>. */ 535 volatile uint32_t i2c_txtide; /*!< 发送FIFO的溢出阈值寄存器 <i>Offset: 0x30</i>. */ 536 volatile uint32_t i2c_ftrper; /*!< I2C毛刺过滤寄存器 <i>Offset: 0x34</i>. */ 537 } i2c_regs_t; 538 539 /** 540 * @} 541 */ 542 543 #ifdef __cplusplus 544 #if __cplusplus 545 } 546 #endif /* __cplusplus */ 547 #endif /* __cplusplus */ 548 549 #endif 550 551