cache.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. // Copyright 2015-2016 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. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef _ROM_CACHE_H_
  14. #define _ROM_CACHE_H_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /** \defgroup uart_apis, uart configuration and communication related apis
  19. * @brief uart apis
  20. */
  21. /** @addtogroup uart_apis
  22. * @{
  23. */
  24. /**
  25. * @brief Initialise cache mmu, mark all entries as invalid.
  26. * Please do not call this function in your SDK application.
  27. *
  28. * @param int cpu_no : 0 for PRO cpu, 1 for APP cpu.
  29. *
  30. * @return None
  31. */
  32. void mmu_init(int cpu_no);
  33. /**
  34. * @brief Set Flash-Cache mmu mapping.
  35. * Please do not call this function in your SDK application.
  36. *
  37. * @param int cpu_no : CPU number, 0 for PRO cpu, 1 for APP cpu.
  38. *
  39. * @param int pod : process identifier. Range 0~7.
  40. *
  41. * @param unsigned int vaddr : virtual address in CPU address space.
  42. * Can be IRam0, IRam1, IRom0 and DRom0 memory address.
  43. * Should be aligned by psize.
  44. *
  45. * @param unsigned int paddr : physical address in Flash.
  46. * Should be aligned by psize.
  47. *
  48. * @param int psize : page size of flash, in kilobytes. Should be 64 here.
  49. *
  50. * @param int num : pages to be set.
  51. *
  52. * @return unsigned int: error status
  53. * 0 : mmu set success
  54. * 1 : vaddr or paddr is not aligned
  55. * 2 : pid error
  56. * 3 : psize error
  57. * 4 : mmu table to be written is out of range
  58. * 5 : vaddr is out of range
  59. */
  60. unsigned int cache_flash_mmu_set(int cpu_no, int pid, unsigned int vaddr, unsigned int paddr, int psize, int num);
  61. /**
  62. * @brief Set Ext-SRAM-Cache mmu mapping.
  63. * Please do not call this function in your SDK application.
  64. *
  65. * @param int cpu_no : CPU number, 0 for PRO cpu, 1 for APP cpu.
  66. *
  67. * @param int pod : process identifier. Range 0~7.
  68. *
  69. * @param unsigned int vaddr : virtual address in CPU address space.
  70. * Can be IRam0, IRam1, IRom0 and DRom0 memory address.
  71. * Should be aligned by psize.
  72. *
  73. * @param unsigned int paddr : physical address in Ext-SRAM.
  74. * Should be aligned by psize.
  75. *
  76. * @param int psize : page size of flash, in kilobytes. Should be 32 here.
  77. *
  78. * @param int num : pages to be set.
  79. *
  80. * @return unsigned int: error status
  81. * 0 : mmu set success
  82. * 1 : vaddr or paddr is not aligned
  83. * 2 : pid error
  84. * 3 : psize error
  85. * 4 : mmu table to be written is out of range
  86. * 5 : vaddr is out of range
  87. */
  88. unsigned int cache_sram_mmu_set(int cpu_no, int pid, unsigned int vaddr, unsigned int paddr, int psize, int num);
  89. /**
  90. * @brief Initialise cache access for the cpu.
  91. * Please do not call this function in your SDK application.
  92. *
  93. * @param int cpu_no : 0 for PRO cpu, 1 for APP cpu.
  94. *
  95. * @return None
  96. */
  97. void Cache_Read_Init(int cpu_no);
  98. /**
  99. * @brief Flush the cache value for the cpu.
  100. * Please do not call this function in your SDK application.
  101. *
  102. * @param int cpu_no : 0 for PRO cpu, 1 for APP cpu.
  103. *
  104. * @return None
  105. */
  106. void Cache_Flush(int cpu_no);
  107. /**
  108. * @brief Disable Cache access for the cpu.
  109. * Please do not call this function in your SDK application.
  110. *
  111. * @param int cpu_no : 0 for PRO cpu, 1 for APP cpu.
  112. *
  113. * @return None
  114. */
  115. void Cache_Read_Disable(int cpu_no);
  116. /**
  117. * @brief Enable Cache access for the cpu.
  118. * Please do not call this function in your SDK application.
  119. *
  120. * @param int cpu_no : 0 for PRO cpu, 1 for APP cpu.
  121. *
  122. * @return None
  123. */
  124. void Cache_Read_Enable(int cpu_no);
  125. /**
  126. * @}
  127. */
  128. #ifdef __cplusplus
  129. }
  130. #endif
  131. #endif /* _ROM_CACHE_H_ */