memprot_defs.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. // Copyright 2020 Espressif Systems (Shanghai) PTE LTD
  2. //
  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. #pragma once
  15. #include "soc/soc.h"
  16. #include "soc/sensitive_reg.h"
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. //IRAM0 interrupt status bitmasks
  21. #define IRAM0_INTR_ST_OP_TYPE_BIT BIT(1) //instruction: 0, data: 1
  22. #define IRAM0_INTR_ST_OP_RW_BIT BIT(0) //read: 0, write: 1
  23. #define CONF_REG_ADDRESS_SHIFT 2
  24. //IRAM0 range
  25. #define IRAM0_SRAM_BASE_ADDRESS 0x40000000
  26. #define IRAM0_SRAM_ADDRESS_LOW 0x40020000
  27. #define IRAM0_SRAM_ADDRESS_HIGH 0x4006FFFF
  28. //IRAM0 unified managemnt blocks
  29. #define IRAM0_SRAM_TOTAL_UNI_BLOCKS 4
  30. #define IRAM0_SRAM_UNI_BLOCK_0 0
  31. #define IRAM0_SRAM_UNI_BLOCK_1 1
  32. #define IRAM0_SRAM_UNI_BLOCK_2 2
  33. #define IRAM0_SRAM_UNI_BLOCK_3 3
  34. //unified management addr range (blocks 0-3)
  35. #define IRAM0_SRAM_UNI_BLOCK_0_LOW 0x40020000
  36. #define IRAM0_SRAM_UNI_BLOCK_1_LOW 0x40022000
  37. #define IRAM0_SRAM_UNI_BLOCK_2_LOW 0x40024000
  38. #define IRAM0_SRAM_UNI_BLOCK_3_LOW 0x40026000
  39. //split management addr range (blocks 4-21)
  40. #define IRAM0_SRAM_SPL_BLOCK_LOW 0x40028000 //block 4 low
  41. #define IRAM0_SRAM_SPL_BLOCK_HIGH 0x4006FFFF //block 21 high
  42. #define IRAM0_INTR_ST_FAULTADDR_M 0x003FFFFC //bits 21:6 in the reg, as well as in real address
  43. #define IRAM0_SRAM_INTR_ST_FAULTADDR_HI 0x40000000 //high nonsignificant bits 31:22 of the faulting address - constant
  44. #define IRAM0_SRAM_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_IRAM0_SRAM_4_SPLTADDR) << DPORT_PMS_PRO_IRAM0_SRAM_4_SPLTADDR_S)
  45. //IRAM0 RTCFAST
  46. #define IRAM0_RTCFAST_ADDRESS_LOW 0x40070000
  47. #define IRAM0_RTCFAST_ADDRESS_HIGH 0x40071FFF
  48. #define IRAM0_RTCFAST_INTR_ST_FAULTADDR_HI 0x40070000 //RTCFAST faulting address high bits (31:22, constant)
  49. #define IRAM0_RTCFAST_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_IRAM0_RTCFAST_SPLTADDR) << DPORT_PMS_PRO_IRAM0_RTCFAST_SPLTADDR_S)
  50. //DRAM0 interrupt status bitmasks
  51. #define DRAM0_INTR_ST_FAULTADDR_M 0x03FFFFC0 //(bits 25:6 in the reg)
  52. #define DRAM0_INTR_ST_FAULTADDR_S 0x4 //(bits 21:2 of real address)
  53. #define DRAM0_INTR_ST_OP_RW_BIT BIT(4) //read: 0, write: 1
  54. #define DRAM0_INTR_ST_OP_ATOMIC_BIT BIT(5) //non-atomic: 0, atomic: 1
  55. #define DRAM0_SRAM_ADDRESS_LOW 0x3FFB0000
  56. #define DRAM0_SRAM_ADDRESS_HIGH 0x3FFFFFFF
  57. #define DRAM0_SRAM_TOTAL_UNI_BLOCKS 4
  58. #define DRAM0_SRAM_UNI_BLOCK_0 0
  59. #define DRAM0_SRAM_UNI_BLOCK_1 1
  60. #define DRAM0_SRAM_UNI_BLOCK_2 2
  61. #define DRAM0_SRAM_UNI_BLOCK_3 3
  62. //unified management (SRAM blocks 0-3)
  63. #define DRAM0_SRAM_UNI_BLOCK_0_LOW 0x3FFB0000
  64. #define DRAM0_SRAM_UNI_BLOCK_1_LOW 0x3FFB2000
  65. #define DRAM0_SRAM_UNI_BLOCK_2_LOW 0x3FFB4000
  66. #define DRAM0_SRAM_UNI_BLOCK_3_LOW 0x3FFB6000
  67. //split management (SRAM blocks 4-21)
  68. #define DRAM0_SRAM_SPL_BLOCK_HIGH 0x3FFFFFFF //block 21 high
  69. #define DRAM0_SRAM_INTR_ST_FAULTADDR_HI 0x3FF00000 //SRAM high bits 31:22 of the faulting address - constant
  70. #define DRAM0_SRAM_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_DRAM0_SRAM_4_SPLTADDR) << DPORT_PMS_PRO_DRAM0_SRAM_4_SPLTADDR_S)
  71. //DRAM0 RTCFAST
  72. #define DRAM0_RTCFAST_ADDRESS_LOW 0x3FF9E000
  73. #define DRAM0_RTCFAST_ADDRESS_HIGH 0x3FF9FFFF
  74. #define DRAM0_RTCFAST_INTR_ST_FAULTADDR_HI 0x3FF00000 //RTCFAST high bits 31:22 of the faulting address - constant
  75. #define DRAM0_RTCFAST_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_DRAM0_RTCFAST_SPLTADDR) << DPORT_PMS_PRO_DRAM0_RTCFAST_SPLTADDR_S)
  76. //RTCSLOW
  77. #define RTCSLOW_MEMORY_SIZE 0x00002000
  78. //PeriBus1 interrupt status bitmasks
  79. #define PERI1_INTR_ST_OP_TYPE_BIT BIT(4) //0: non-atomic, 1: atomic
  80. #define PERI1_INTR_ST_OP_HIGH_BITS BIT(5) //0: high bits = unchanged, 1: high bits = 0x03F40000
  81. #define PERI1_INTR_ST_FAULTADDR_M 0x03FFFFC0 //(bits 25:6 in the reg)
  82. #define PERI1_INTR_ST_FAULTADDR_S 0x4 //(bits 21:2 of real address)
  83. #define PERI1_RTCSLOW_ADDRESS_BASE 0x3F421000
  84. #define PERI1_RTCSLOW_ADDRESS_LOW PERI1_RTCSLOW_ADDRESS_BASE
  85. #define PERI1_RTCSLOW_ADDRESS_HIGH PERI1_RTCSLOW_ADDRESS_LOW + RTCSLOW_MEMORY_SIZE
  86. #define PERI1_RTCSLOW_INTR_ST_FAULTADDR_HI_0 0x3F400000
  87. #define PERI1_RTCSLOW_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_DPORT_RTCSLOW_SPLTADDR) << DPORT_PMS_PRO_DPORT_RTCSLOW_SPLTADDR_S)
  88. //PeriBus2 interrupt status bitmasks
  89. #define PERI2_INTR_ST_OP_TYPE_BIT BIT(1) //instruction: 0, data: 1
  90. #define PERI2_INTR_ST_OP_RW_BIT BIT(0) //read: 0, write: 1
  91. #define PERI2_INTR_ST_FAULTADDR_M 0xFFFFFFFC //(bits 31:2 in the reg)
  92. #define PERI2_RTCSLOW_0_ADDRESS_BASE 0x50000000
  93. #define PERI2_RTCSLOW_0_ADDRESS_LOW PERI2_RTCSLOW_0_ADDRESS_BASE
  94. #define PERI2_RTCSLOW_0_ADDRESS_HIGH PERI2_RTCSLOW_0_ADDRESS_LOW + RTCSLOW_MEMORY_SIZE
  95. #define PERI2_RTCSLOW_0_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_AHB_RTCSLOW_0_SPLTADDR) << DPORT_PMS_PRO_AHB_RTCSLOW_0_SPLTADDR_S)
  96. #define PERI2_RTCSLOW_1_ADDRESS_BASE 0x60021000
  97. #define PERI2_RTCSLOW_1_ADDRESS_LOW PERI2_RTCSLOW_1_ADDRESS_BASE
  98. #define PERI2_RTCSLOW_1_ADDRESS_HIGH PERI2_RTCSLOW_1_ADDRESS_LOW + RTCSLOW_MEMORY_SIZE
  99. #define PERI2_RTCSLOW_1_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_AHB_RTCSLOW_1_SPLTADDR) << DPORT_PMS_PRO_AHB_RTCSLOW_1_SPLTADDR_S)
  100. #ifdef __cplusplus
  101. }
  102. #endif