cache.h 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178
  1. // Copyright 2015-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 <stdint.h>
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. #ifndef BIT
  20. #define BIT(nr) (1 << (nr))
  21. #endif
  22. /** \defgroup cache_apis, cache operation related apis
  23. * @brief cache apis
  24. */
  25. /** @addtogroup cache_apis
  26. * @{
  27. */
  28. #define MIN_ICACHE_SIZE 16384
  29. #define MAX_ICACHE_SIZE 32768
  30. #define MIN_DCACHE_SIZE 32768
  31. #define MAX_DCACHE_SIZE 65536
  32. #define MIN_ICACHE_WAYS 4
  33. #define MAX_ICACHE_WAYS 8
  34. #define MIN_DCACHE_WAYS 4
  35. #define MAX_DCACHE_WAYS 4
  36. #define MAX_CACHE_WAYS 8
  37. #define MIN_CACHE_LINE_SIZE 16
  38. #define TAG_SIZE 4
  39. #define MIN_ICACHE_BANK_NUM 1
  40. #define MAX_ICACHE_BANK_NUM 2
  41. #define MIN_DCACHE_BANK_NUM 1
  42. #define MAX_DCACHE_BANK_NUM 2
  43. #define CACHE_MEMORY_BANK_NUM 4
  44. #define CACHE_MEMORY_IBANK_SIZE 0x4000
  45. #define CACHE_MEMORY_DBANK_SIZE 0x8000
  46. #define MAX_ITAG_BANK_ITEMS (MAX_ICACHE_SIZE / MAX_ICACHE_BANK_NUM / MIN_CACHE_LINE_SIZE)
  47. #define MAX_ITAG_BLOCK_ITEMS (MAX_ICACHE_SIZE / MAX_ICACHE_BANK_NUM / MAX_ICACHE_WAYS / MIN_CACHE_LINE_SIZE)
  48. #define MAX_ITAG_BANK_SIZE (MAX_ITAG_BANK_ITEMS * TAG_SIZE)
  49. #define MAX_ITAG_BLOCK_SIZE (MAX_ITAG_BLOCK_ITEMS * TAG_SIZE)
  50. #define MAX_DTAG_BANK_ITEMS (MAX_DCACHE_SIZE / MAX_DCACHE_BANK_NUM / MIN_CACHE_LINE_SIZE)
  51. #define MAX_DTAG_BLOCK_ITEMS (MAX_DCACHE_SIZE / MAX_DCACHE_BANK_NUM / MAX_DCACHE_WAYS / MIN_CACHE_LINE_SIZE)
  52. #define MAX_DTAG_BANK_SIZE (MAX_DTAG_BANK_ITEMS * TAG_SIZE)
  53. #define MAX_DTAG_BLOCK_SIZE (MAX_DTAG_BLOCK_ITEMS * TAG_SIZE)
  54. typedef enum {
  55. CACHE_DCACHE = 0,
  56. CACHE_ICACHE0 = 1,
  57. CACHE_ICACHE1 = 2,
  58. } cache_t;
  59. typedef enum {
  60. CACHE_MEMORY_INVALID = 0,
  61. CACHE_MEMORY_IBANK0 = BIT(0),
  62. CACHE_MEMORY_IBANK1 = BIT(1),
  63. CACHE_MEMORY_IBANK2 = BIT(2),
  64. CACHE_MEMORY_IBANK3 = BIT(3),
  65. CACHE_MEMORY_DBANK0 = BIT(0),
  66. CACHE_MEMORY_DBANK1 = BIT(1),
  67. CACHE_MEMORY_DBANK2 = BIT(2),
  68. CACHE_MEMORY_DBANK3 = BIT(3),
  69. } cache_array_t;
  70. #define ICACHE_SIZE_16KB CACHE_SIZE_HALF
  71. #define ICACHE_SIZE_32KB CACHE_SIZE_FULL
  72. #define DCACHE_SIZE_32KB CACHE_SIZE_HALF
  73. #define DCACHE_SIZE_64KB CACHE_SIZE_FULL
  74. typedef enum {
  75. CACHE_SIZE_HALF = 0, /*!< 8KB for icache and dcache */
  76. CACHE_SIZE_FULL = 1, /*!< 16KB for icache and dcache */
  77. } cache_size_t;
  78. typedef enum {
  79. CACHE_4WAYS_ASSOC = 0, /*!< 4 way associated cache */
  80. CACHE_8WAYS_ASSOC = 1, /*!< 8 way associated cache */
  81. } cache_ways_t;
  82. typedef enum {
  83. CACHE_LINE_SIZE_16B = 0, /*!< 16 Byte cache line size */
  84. CACHE_LINE_SIZE_32B = 1, /*!< 32 Byte cache line size */
  85. CACHE_LINE_SIZE_64B = 2, /*!< 64 Byte cache line size */
  86. } cache_line_size_t;
  87. typedef enum {
  88. CACHE_AUTOLOAD_POSITIVE = 0, /*!< cache autoload step is positive */
  89. CACHE_AUTOLOAD_NEGATIVE = 1, /*!< cache autoload step is negative */
  90. } cache_autoload_order_t;
  91. typedef enum {
  92. CACHE_AUTOLOAD_REGION0 = 0, /*!< cache autoload region0 */
  93. CACHE_AUTOLOAD_REGION1 = 1, /*!< cache autoload region1 */
  94. } cache_autoload_region_t;
  95. #define CACHE_AUTOLOAD_STEP(i) ((i) - 1)
  96. typedef enum {
  97. CACHE_AUTOLOAD_MISS_TRIGGER = 0, /*!< autoload only triggered by cache miss */
  98. CACHE_AUTOLOAD_HIT_TRIGGER = 1, /*!< autoload only triggered by cache hit */
  99. CACHE_AUTOLOAD_BOTH_TRIGGER = 2, /*!< autoload triggered both by cache miss and hit */
  100. } cache_autoload_trigger_t;
  101. typedef enum {
  102. CACHE_FREEZE_ACK_BUSY = 0, /*!< in this mode, cache ack busy to CPU if a cache miss happens*/
  103. CACHE_FREEZE_ACK_ERROR = 1, /*!< in this mode, cache ack wrong data to CPU and trigger an error if a cache miss happens */
  104. } cache_freeze_mode_t;
  105. struct cache_mode {
  106. uint32_t cache_size; /*!< cache size in byte */
  107. uint16_t cache_line_size; /*!< cache line size in byte */
  108. uint8_t cache_ways; /*!< cache ways, always 4 */
  109. uint8_t icache; /*!< the cache index, 0 for dcache, 1 for icache */
  110. };
  111. struct icache_tag_item {
  112. uint32_t valid: 1; /*!< the tag item is valid or not */
  113. uint32_t lock: 1; /*!< the cache line is locked or not */
  114. uint32_t attr: 4; /*!< the attribute of the external memory physical address */
  115. uint32_t fifo_cnt: 3; /*!< fifo cnt, 0 ~ 3 for 4 ways cache */
  116. uint32_t tag: 14; /*!< the tag is the high part of the cache address, however is only 64MB range, and without low part */
  117. uint32_t reserved: 9;
  118. };
  119. struct dcache_tag_item {
  120. uint32_t dirty: 1; /*!< the cache line value is dirty or not */
  121. uint32_t valid: 1; /*!< the tag item is valid or not */
  122. uint32_t lock: 1; /*!< the cache line is locked or not */
  123. uint32_t occupy: 1; /*!< the cache line is occupied as internal sram */
  124. uint32_t attr: 4; /*!< the attribute of the external memory physical address */
  125. uint32_t fifo_cnt: 2; /*!< fifo cnt, 0 ~ 3 for 4 ways cache */
  126. uint32_t tag: 13; /*!< the tag is the high part of the cache address, however is only 64MB range, and without low part */
  127. uint32_t reserved: 9;
  128. };
  129. struct autoload_config {
  130. uint8_t ena; /*!< autoload enable */
  131. uint8_t order; /*!< autoload step is positive or negative */
  132. uint8_t trigger; /*!< autoload trigger */
  133. uint8_t size; /*!< autoload size */
  134. };
  135. struct autoload_region_config {
  136. uint8_t region; /*!< autoload region*/
  137. uint8_t ena; /*!< autoload region enable */
  138. uint32_t addr; /*!< autoload region start address */
  139. uint32_t size; /*!< autoload region size */
  140. };
  141. struct tag_group_info {
  142. struct cache_mode mode; /*!< cache and cache mode */
  143. uint32_t filter_addr; /*!< the address that used to generate the struct */
  144. uint32_t vaddr_offset; /*!< virtual address offset of the cache ways */
  145. uint32_t tag_addr[MAX_CACHE_WAYS]; /*!< tag memory address, only [0~mode.ways-1] is valid to use */
  146. uint32_t cache_memory_offset[MAX_CACHE_WAYS]; /*!< cache memory address, only [0~mode.ways-1] is valid to use */
  147. uint8_t use_legacy; /*!< 1 for using legacy tag api, 0 for using 2rd tag api */
  148. };
  149. struct lock_config {
  150. uint32_t addr; /*!< manual lock address*/
  151. uint16_t size; /*!< manual lock size*/
  152. uint16_t group; /*!< manual lock group, 0 or 1*/
  153. };
  154. struct cache_internal_stub_table {
  155. uint32_t (* icache_line_size)(void);
  156. uint32_t (* dcache_line_size)(void);
  157. uint32_t (* icache_addr)(uint32_t addr);
  158. uint32_t (* dcache_addr)(uint32_t addr);
  159. void (* invalidate_icache_items)(uint32_t addr, uint32_t items);
  160. void (* invalidate_dcache_items)(uint32_t addr, uint32_t items);
  161. void (* clean_items)(uint32_t addr, uint32_t items);
  162. void (* writeback_items)(uint32_t addr, uint32_t items);
  163. void (* lock_icache_items)(uint32_t addr, uint32_t items);
  164. void (* lock_dcache_items)(uint32_t addr, uint32_t items);
  165. void (* unlock_icache_items)(uint32_t addr, uint32_t items);
  166. void (* unlock_dcache_items)(uint32_t addr, uint32_t items);
  167. void (* occupy_items)(uint32_t addr, uint32_t items);
  168. uint32_t (* suspend_icache_autoload)(void);
  169. void (* resume_icache_autoload)(uint32_t autoload);
  170. uint32_t (* suspend_dcache_autoload)(void);
  171. void (* resume_dcache_autoload)(uint32_t autoload);
  172. void (* freeze_icache_enable)(cache_freeze_mode_t mode);
  173. void (* freeze_icache_disable)(void);
  174. void (* freeze_dcache_enable)(cache_freeze_mode_t mode);
  175. void (* freeze_dcache_disable)(void);
  176. int (* op_addr)(uint32_t op_icache, uint32_t start_addr, uint32_t size, uint32_t cache_line_size, uint32_t max_sync_num, void(* cache_Iop)(uint32_t, uint32_t), void(* cache_Dop)(uint32_t, uint32_t));
  177. };
  178. typedef void (* cache_op_start)(void);
  179. typedef void (* cache_op_end)(void);
  180. typedef struct {
  181. cache_op_start start;
  182. cache_op_end end;
  183. } cache_op_cb_t;
  184. #define ESP_ROM_ERR_INVALID_ARG 1
  185. #define MMU_SET_ADDR_ALIGNED_ERROR 2
  186. #define MMU_SET_PASE_SIZE_ERROR 3
  187. #define MMU_SET_VADDR_OUT_RANGE 4
  188. #define CACHE_OP_ICACHE_Y 1
  189. #define CACHE_OP_ICACHE_N 0
  190. /**
  191. * @brief Initialise cache mmu, mark all entries as invalid.
  192. * Please do not call this function in your SDK application.
  193. *
  194. * @param None
  195. *
  196. * @return None
  197. */
  198. void Cache_MMU_Init(void);
  199. /**
  200. * @brief Set ICache mmu mapping.
  201. * Please do not call this function in your SDK application.
  202. *
  203. * @param uint32_t ext_ram : MMU_ACCESS_FLASH for flash, MMU_ACCESS_SPIRAM for spiram, MMU_INVALID for invalid.
  204. *
  205. * @param uint32_t vaddr : virtual address in CPU address space.
  206. * Can be Iram0,Iram1,Irom0,Drom0 and AHB buses address.
  207. * Should be aligned by psize.
  208. *
  209. * @param uint32_t paddr : physical address in external memory.
  210. * Should be aligned by psize.
  211. *
  212. * @param uint32_t psize : page size of ICache, in kilobytes. Should be 64 here.
  213. *
  214. * @param uint32_t num : pages to be set.
  215. *
  216. * @param uint32_t fixed : 0 for physical pages grow with virtual pages, other for virtual pages map to same physical page.
  217. *
  218. * @return uint32_t: error status
  219. * 0 : mmu set success
  220. * 2 : vaddr or paddr is not aligned
  221. * 3 : psize error
  222. * 4 : vaddr is out of range
  223. */
  224. int Cache_Ibus_MMU_Set(uint32_t ext_ram, uint32_t vaddr, uint32_t paddr, uint32_t psize, uint32_t num, uint32_t fixed);
  225. /**
  226. * @brief Set DCache mmu mapping.
  227. * Please do not call this function in your SDK application.
  228. *
  229. * @param uint32_t ext_ram : MMU_ACCESS_FLASH for flash, MMU_ACCESS_SPIRAM for spiram, MMU_INVALID for invalid.
  230. *
  231. * @param uint32_t vaddr : virtual address in CPU address space.
  232. * Can be DRam0, DRam1, DRom0, DPort and AHB buses address.
  233. * Should be aligned by psize.
  234. *
  235. * @param uint32_t paddr : physical address in external memory.
  236. * Should be aligned by psize.
  237. *
  238. * @param uint32_t psize : page size of DCache, in kilobytes. Should be 64 here.
  239. *
  240. * @param uint32_t num : pages to be set.
  241. * @param uint32_t fixed : 0 for physical pages grow with virtual pages, other for virtual pages map to same physical page.
  242. *
  243. * @return uint32_t: error status
  244. * 0 : mmu set success
  245. * 2 : vaddr or paddr is not aligned
  246. * 3 : psize error
  247. * 4 : vaddr is out of range
  248. */
  249. int Cache_Dbus_MMU_Set(uint32_t ext_ram, uint32_t vaddr, uint32_t paddr, uint32_t psize, uint32_t num, uint32_t fixed);
  250. /**
  251. * @brief Count the pages in the bus room address which map to Flash.
  252. * Please do not call this function in your SDK application.
  253. *
  254. * @param uint32_t bus : the bus to count with.
  255. *
  256. * @param uint32_t * page0_mapped : value should be initial by user, 0 for not mapped, other for mapped count.
  257. *
  258. * return uint32_t : the number of pages which map to Flash.
  259. */
  260. uint32_t Cache_Count_Flash_Pages(uint32_t bus, uint32_t *page0_mapped);
  261. /**
  262. * @brief Copy Instruction or rodata from Flash to SPIRAM, and remap to SPIRAM.
  263. * Please do not call this function in your SDK application.
  264. *
  265. * @param uint32_t bus : the bus which need to copy to SPIRAM.
  266. *
  267. * @param uint32_t bus_start_addr : the start virtual address for the bus.
  268. *
  269. * @param uint32_t start_page : the start (64KB) page number in SPIRAM.
  270. *
  271. * @param uint32_t * page0_page : the flash page0 in SPIRAM page number, 0xffff for invalid.
  272. *
  273. * return uint32_t : the next start page number for SPIRAM not mapped.
  274. */
  275. uint32_t Cache_Flash_To_SPIRAM_Copy(uint32_t bus, uint32_t bus_start_addr, uint32_t start_page, uint32_t *page0_page);
  276. /**
  277. * @brief allocate memory to used by ICache.
  278. * Please do not call this function in your SDK application.
  279. *
  280. * @param cache_array_t icache_low : the data array bank used by icache low part. Due to timing constraint, can only be CACHE_MEMORY_INVALID, CACHE_MEMORY_IBANK0
  281. *
  282. * @param cache_array_t icache_high : the data array bank used by icache high part. Due to timing constraint, can only be CACHE_MEMORY_INVALID, or CACHE_MEMORY_IBANK1 only if icache_low and icache_high is CACHE_MEMORY_IBANK0
  283. *
  284. * return none
  285. */
  286. void Cache_Occupy_ICache_MEMORY(cache_array_t icache_low, cache_array_t icache_high);
  287. /**
  288. * @brief allocate memory to used by DCache.
  289. * Please do not call this function in your SDK application.
  290. *
  291. * @param cache_array_t dcache_low : the data array bank used by dcache low part. Due to timing constraint, can only be CACHE_MEMORY_INVALID, CACHE_MEMORY_DBANK1
  292. *
  293. * @param cache_array_t dcache1_high : the data array bank used by dcache high part. Due to timing constraint, can only be CACHE_MEMORY_INVALID, or CACHE_MEMORY_DBANK0 only if dcache_low0 and dcache_low1 is CACHE_MEMORY_DBANK1
  294. *
  295. * return none
  296. */
  297. void Cache_Occupy_DCache_MEMORY(cache_array_t dcache_low, cache_array_t dcache_high);
  298. /**
  299. * @brief Get cache mode of ICache or DCache.
  300. * Please do not call this function in your SDK application.
  301. *
  302. * @param struct cache_mode * mode : the pointer of cache mode struct, caller should set the icache field
  303. *
  304. * return none
  305. */
  306. void Cache_Get_Mode(struct cache_mode *mode);
  307. /**
  308. * @brief set ICache modes: cache size, associate ways and cache line size.
  309. * Please do not call this function in your SDK application.
  310. *
  311. * @param cache_size_t cache_size : the cache size, can be CACHE_SIZE_HALF and CACHE_SIZE_FULL
  312. *
  313. * @param cache_ways_t ways : the associate ways of cache, can be CACHE_4WAYS_ASSOC and CACHE_8WAYS_ASSOC
  314. *
  315. * @param cache_line_size_t cache_line_size : the cache line size, can be CACHE_LINE_SIZE_16B and CACHE_LINE_SIZE_32B
  316. *
  317. * return none
  318. */
  319. void Cache_Set_ICache_Mode(cache_size_t cache_size, cache_ways_t ways, cache_line_size_t cache_line_size);
  320. /**
  321. * @brief set DCache modes: cache size, associate ways and cache line size.
  322. * Please do not call this function in your SDK application.
  323. *
  324. * @param cache_size_t cache_size : the cache size, can be CACHE_SIZE_HALF and CACHE_SIZE_FULL
  325. *
  326. * @param cache_ways_t ways : the associate ways of cache, can be CACHE_4WAYS_ASSOC and CACHE_8WAYS_ASSOC, only CACHE_4WAYS_ASSOC works
  327. *
  328. * @param cache_line_size_t cache_line_size : the cache line size, can be CACHE_LINE_SIZE_16B, CACHE_LINE_SIZE_32B and CACHE_LINE_SIZE_64B
  329. *
  330. * return none
  331. */
  332. void Cache_Set_DCache_Mode(cache_size_t cache_size, cache_ways_t ways, cache_line_size_t cache_line_size);
  333. /**
  334. * @brief check if the address is accessed through ICache.
  335. * Please do not call this function in your SDK application.
  336. *
  337. * @param uint32_t addr : the address to check.
  338. *
  339. * @return 1 if the address is accessed through ICache, 0 if not.
  340. */
  341. uint32_t Cache_Address_Through_ICache(uint32_t addr);
  342. /**
  343. * @brief check if the address is accessed through DCache.
  344. * Please do not call this function in your SDK application.
  345. *
  346. * @param uint32_t addr : the address to check.
  347. *
  348. * @return 1 if the address is accessed through DCache, 0 if not.
  349. */
  350. uint32_t Cache_Address_Through_DCache(uint32_t addr);
  351. /**
  352. * @brief Init Cache for ROM boot, including resetting the Dcache, initializing Owner, MMU, setting DCache mode, Enabling DCache, unmasking bus.
  353. *
  354. * @param None
  355. *
  356. * @return None
  357. */
  358. void Cache_Owner_Init(void);
  359. /**
  360. * @brief Invalidate the cache items for ICache.
  361. * Operation will be done CACHE_LINE_SIZE aligned.
  362. * If the region is not in ICache addr room, nothing will be done.
  363. * Please do not call this function in your SDK application.
  364. *
  365. * @param uint32_t addr: start address to invalidate
  366. *
  367. * @param uint32_t items: cache lines to invalidate, items * cache_line_size should not exceed the bus address size(16MB/32MB/64MB)
  368. *
  369. * @return None
  370. */
  371. void Cache_Invalidate_ICache_Items(uint32_t addr, uint32_t items);
  372. /**
  373. * @brief Invalidate the cache items for DCache.
  374. * Operation will be done CACHE_LINE_SIZE aligned.
  375. * If the region is not in DCache addr room, nothing will be done.
  376. * Please do not call this function in your SDK application.
  377. *
  378. * @param uint32_t addr: start address to invalidate
  379. *
  380. * @param uint32_t items: cache lines to invalidate, items * cache_line_size should not exceed the bus address size(16MB/32MB/64MB)
  381. *
  382. * @return None
  383. */
  384. void Cache_Invalidate_DCache_Items(uint32_t addr, uint32_t items);
  385. /**
  386. * @brief Clean the dirty bit of cache Items of DCache.
  387. * Operation will be done CACHE_LINE_SIZE aligned.
  388. * If the region is not in DCache addr room, nothing will be done.
  389. * Please do not call this function in your SDK application.
  390. *
  391. * @param uint32_t addr: start address to Clean
  392. *
  393. * @param uint32_t items: cache lines to invalidate, items * cache_line_size should not exceed the bus address size(16MB/32MB/64MB)
  394. *
  395. * @return None
  396. */
  397. void Cache_Clean_Items(uint32_t addr, uint32_t items);
  398. /**
  399. * @brief Write back the cache items of DCache.
  400. * Operation will be done CACHE_LINE_SIZE aligned.
  401. * If the region is not in DCache addr room, nothing will be done.
  402. * Please do not call this function in your SDK application.
  403. *
  404. * @param uint32_t addr: start address to write back
  405. *
  406. * @param uint32_t items: cache lines to invalidate, items * cache_line_size should not exceed the bus address size(16MB/32MB/64MB)
  407. *
  408. * @return None
  409. */
  410. void Cache_WriteBack_Items(uint32_t addr, uint32_t items);
  411. /**
  412. * @brief Invalidate the Cache items in the region from ICache or DCache.
  413. * If the region is not in Cache addr room, nothing will be done.
  414. * Please do not call this function in your SDK application.
  415. *
  416. * @param uint32_t addr : invalidated region start address.
  417. *
  418. * @param uint32_t size : invalidated region size.
  419. *
  420. * @return 0 for success
  421. * 1 for invalid argument
  422. */
  423. int Cache_Invalidate_Addr(uint32_t addr, uint32_t size);
  424. /**
  425. * @brief Clean the dirty bit of Cache items in the region from DCache.
  426. * If the region is not in DCache addr room, nothing will be done.
  427. * Please do not call this function in your SDK application.
  428. *
  429. * @param uint32_t addr : cleaned region start address.
  430. *
  431. * @param uint32_t size : cleaned region size.
  432. *
  433. * @return 0 for success
  434. * 1 for invalid argument
  435. */
  436. int Cache_Clean_Addr(uint32_t addr, uint32_t size);
  437. /**
  438. * @brief Writeback the Cache items(also clean the dirty bit) in the region from DCache.
  439. * If the region is not in DCache addr room, nothing will be done.
  440. * Please do not call this function in your SDK application.
  441. *
  442. * @param uint32_t addr : writeback region start address.
  443. *
  444. * @param uint32_t size : writeback region size.
  445. *
  446. * @return 0 for success
  447. * 1 for invalid argument
  448. */
  449. int Cache_WriteBack_Addr(uint32_t addr, uint32_t size);
  450. /**
  451. * @brief Invalidate all cache items in ICache.
  452. * Please do not call this function in your SDK application.
  453. *
  454. * @param None
  455. *
  456. * @return None
  457. */
  458. void Cache_Invalidate_ICache_All(void);
  459. /**
  460. * @brief Invalidate all cache items in DCache.
  461. * Please do not call this function in your SDK application.
  462. *
  463. * @param None
  464. *
  465. * @return None
  466. */
  467. void Cache_Invalidate_DCache_All(void);
  468. /**
  469. * @brief Clean the dirty bit of all cache items in DCache.
  470. * Please do not call this function in your SDK application.
  471. *
  472. * @param None
  473. *
  474. * @return None
  475. */
  476. void Cache_Clean_All(void);
  477. /**
  478. * @brief WriteBack all cache items in DCache.
  479. * Please do not call this function in your SDK application.
  480. *
  481. * @param None
  482. *
  483. * @return None
  484. */
  485. void Cache_WriteBack_All(void);
  486. /**
  487. * @brief Mask all buses through ICache and DCache.
  488. * Please do not call this function in your SDK application.
  489. *
  490. * @param None
  491. *
  492. * @return None
  493. */
  494. void Cache_Mask_All(void);
  495. /**
  496. * @brief UnMask DRam0 bus through DCache.
  497. * Please do not call this function in your SDK application.
  498. *
  499. * @param None
  500. *
  501. * @return None
  502. */
  503. void Cache_UnMask_Dram0(void);
  504. /**
  505. * @brief Suspend ICache auto preload operation, then you can resume it after some ICache operations.
  506. * Please do not call this function in your SDK application.
  507. *
  508. * @param None
  509. *
  510. * @return uint32_t : 0 for ICache not auto preload before suspend.
  511. */
  512. uint32_t Cache_Suspend_ICache_Autoload(void);
  513. /**
  514. * @brief Resume ICache auto preload operation after some ICache operations.
  515. * Please do not call this function in your SDK application.
  516. *
  517. * @param uint32_t autoload : 0 for ICache not auto preload before suspend.
  518. *
  519. * @return None.
  520. */
  521. void Cache_Resume_ICache_Autoload(uint32_t autoload);
  522. /**
  523. * @brief Suspend DCache auto preload operation, then you can resume it after some DCache operations.
  524. * Please do not call this function in your SDK application.
  525. *
  526. * @param None
  527. *
  528. * @return uint32_t : 0 for DCache not auto preload before suspend.
  529. */
  530. uint32_t Cache_Suspend_DCache_Autoload(void);
  531. /**
  532. * @brief Resume DCache auto preload operation after some DCache operations.
  533. * Please do not call this function in your SDK application.
  534. *
  535. * @param uint32_t autoload : 0 for DCache not auto preload before suspend.
  536. *
  537. * @return None.
  538. */
  539. void Cache_Resume_DCache_Autoload(uint32_t autoload);
  540. /**
  541. * @brief Start an ICache manual preload, will suspend auto preload of ICache.
  542. * Please do not call this function in your SDK application.
  543. *
  544. * @param uint32_t addr : start address of the preload region.
  545. *
  546. * @param uint32_t size : size of the preload region, should not exceed the size of ICache.
  547. *
  548. * @param uint32_t order : the preload order, 0 for positive, other for negative
  549. *
  550. * @return uint32_t : 0 for ICache not auto preload before manual preload.
  551. */
  552. uint32_t Cache_Start_ICache_Preload(uint32_t addr, uint32_t size, uint32_t order);
  553. /**
  554. * @brief Return if the ICache manual preload done.
  555. * Please do not call this function in your SDK application.
  556. *
  557. * @param None
  558. *
  559. * @return uint32_t : 0 for ICache manual preload not done.
  560. */
  561. uint32_t Cache_ICache_Preload_Done(void);
  562. /**
  563. * @brief End the ICache manual preload to resume auto preload of ICache.
  564. * Please do not call this function in your SDK application.
  565. *
  566. * @param uint32_t autoload : 0 for ICache not auto preload before manual preload.
  567. *
  568. * @return None
  569. */
  570. void Cache_End_ICache_Preload(uint32_t autoload);
  571. /**
  572. * @brief Start an DCache manual preload, will suspend auto preload of DCache.
  573. * Please do not call this function in your SDK application.
  574. *
  575. * @param uint32_t addr : start address of the preload region.
  576. *
  577. * @param uint32_t size : size of the preload region, should not exceed the size of DCache.
  578. *
  579. * @param uint32_t order : the preload order, 0 for positive, other for negative
  580. *
  581. * @return uint32_t : 0 for DCache not auto preload before manual preload.
  582. */
  583. uint32_t Cache_Start_DCache_Preload(uint32_t addr, uint32_t size, uint32_t order);
  584. /**
  585. * @brief Return if the DCache manual preload done.
  586. * Please do not call this function in your SDK application.
  587. *
  588. * @param None
  589. *
  590. * @return uint32_t : 0 for DCache manual preload not done.
  591. */
  592. uint32_t Cache_DCache_Preload_Done(void);
  593. /**
  594. * @brief End the DCache manual preload to resume auto preload of DCache.
  595. * Please do not call this function in your SDK application.
  596. *
  597. * @param uint32_t autoload : 0 for DCache not auto preload before manual preload.
  598. *
  599. * @return None
  600. */
  601. void Cache_End_DCache_Preload(uint32_t autoload);
  602. /**
  603. * @brief Config autoload parameters of ICache.
  604. * Please do not call this function in your SDK application.
  605. *
  606. * @param struct autoload_config * config : autoload parameters.
  607. *
  608. * @return None
  609. */
  610. void Cache_Config_ICache_Autoload(const struct autoload_config *config);
  611. /**
  612. * @brief Config region autoload parameters of ICache.
  613. * Please do not call this function in your SDK application.
  614. *
  615. * @param struct autoload_region_config * config : region autoload parameters.
  616. *
  617. * @return ESP_ROM_ERR_INVALID_ARG : invalid param, 0 : success
  618. */
  619. int Cache_Config_ICache_Region_Autoload(const struct autoload_region_config *config);
  620. /**
  621. * @brief Enable auto preload for ICache.
  622. * Please do not call this function in your SDK application.
  623. *
  624. * @param None
  625. *
  626. * @return None
  627. */
  628. void Cache_Enable_ICache_Autoload(void);
  629. /**
  630. * @brief Disable auto preload for ICache.
  631. * Please do not call this function in your SDK application.
  632. *
  633. * @param None
  634. *
  635. * @return None
  636. */
  637. void Cache_Disable_ICache_Autoload(void);
  638. /**
  639. * @brief Config autoload parameters of DCache.
  640. * Please do not call this function in your SDK application.
  641. *
  642. * @param struct autoload_config * config : autoload parameters.
  643. *
  644. * @return None
  645. */
  646. void Cache_Config_DCache_Autoload(const struct autoload_config *config);
  647. /**
  648. * @brief Config region autoload parameters of DCache.
  649. * Please do not call this function in your SDK application.
  650. *
  651. * @param struct autoload_region_config * config : region autoload parameters.
  652. *
  653. * @return ESP_ROM_ERR_INVALID_ARG : invalid param, 0 : success
  654. */
  655. int Cache_Config_DCache_Region_Autoload(const struct autoload_region_config *config);
  656. /**
  657. * @brief Enable auto preload for DCache.
  658. * Please do not call this function in your SDK application.
  659. *
  660. * @param None
  661. *
  662. * @return None
  663. */
  664. void Cache_Enable_DCache_Autoload(void);
  665. /**
  666. * @brief Disable auto preload for DCache.
  667. * Please do not call this function in your SDK application.
  668. *
  669. * @param None
  670. *
  671. * @return None
  672. */
  673. void Cache_Disable_DCache_Autoload(void);
  674. /**
  675. * @brief Config a group of prelock parameters of ICache.
  676. * Please do not call this function in your SDK application.
  677. *
  678. * @param struct lock_config * config : a group of lock parameters.
  679. *
  680. * @return None
  681. */
  682. void Cache_Enable_ICache_PreLock(const struct lock_config *config);
  683. /**
  684. * @brief Disable a group of prelock parameters for ICache.
  685. * However, the locked data will not be released.
  686. * Please do not call this function in your SDK application.
  687. *
  688. * @param uint16_t group : 0 for group0, 1 for group1.
  689. *
  690. * @return None
  691. */
  692. void Cache_Disable_ICache_PreLock(uint16_t group);
  693. /**
  694. * @brief Lock the cache items for ICache.
  695. * Operation will be done CACHE_LINE_SIZE aligned.
  696. * If the region is not in ICache addr room, nothing will be done.
  697. * Please do not call this function in your SDK application.
  698. *
  699. * @param uint32_t addr: start address to lock
  700. *
  701. * @param uint32_t items: cache lines to lock, items * cache_line_size should not exceed the bus address size(16MB/32MB/64MB)
  702. *
  703. * @return None
  704. */
  705. void Cache_Lock_ICache_Items(uint32_t addr, uint32_t items);
  706. /**
  707. * @brief Unlock the cache items for ICache.
  708. * Operation will be done CACHE_LINE_SIZE aligned.
  709. * If the region is not in ICache addr room, nothing will be done.
  710. * Please do not call this function in your SDK application.
  711. *
  712. * @param uint32_t addr: start address to unlock
  713. *
  714. * @param uint32_t items: cache lines to unlock, items * cache_line_size should not exceed the bus address size(16MB/32MB/64MB)
  715. *
  716. * @return None
  717. */
  718. void Cache_Unlock_ICache_Items(uint32_t addr, uint32_t items);
  719. /**
  720. * @brief Config a group of prelock parameters of DCache.
  721. * Please do not call this function in your SDK application.
  722. *
  723. * @param struct lock_config * config : a group of lock parameters.
  724. *
  725. * @return None
  726. */
  727. void Cache_Enable_DCache_PreLock(const struct lock_config *config);
  728. /**
  729. * @brief Disable a group of prelock parameters for DCache.
  730. * However, the locked data will not be released.
  731. * Please do not call this function in your SDK application.
  732. *
  733. * @param uint16_t group : 0 for group0, 1 for group1.
  734. *
  735. * @return None
  736. */
  737. void Cache_Disable_DCache_PreLock(uint16_t group);
  738. /**
  739. * @brief Lock the cache items for DCache.
  740. * Operation will be done CACHE_LINE_SIZE aligned.
  741. * If the region is not in DCache addr room, nothing will be done.
  742. * Please do not call this function in your SDK application.
  743. *
  744. * @param uint32_t addr: start address to lock
  745. *
  746. * @param uint32_t items: cache lines to lock, items * cache_line_size should not exceed the bus address size(16MB/32MB/64MB)
  747. *
  748. * @return None
  749. */
  750. void Cache_Lock_DCache_Items(uint32_t addr, uint32_t items);
  751. /**
  752. * @brief Unlock the cache items for DCache.
  753. * Operation will be done CACHE_LINE_SIZE aligned.
  754. * If the region is not in DCache addr room, nothing will be done.
  755. * Please do not call this function in your SDK application.
  756. *
  757. * @param uint32_t addr: start address to unlock
  758. *
  759. * @param uint32_t items: cache lines to unlock, items * cache_line_size should not exceed the bus address size(16MB/32MB/64MB)
  760. *
  761. * @return None
  762. */
  763. void Cache_Unlock_DCache_Items(uint32_t addr, uint32_t items);
  764. /**
  765. * @brief Lock the cache items in tag memory for ICache or DCache.
  766. * Please do not call this function in your SDK application.
  767. *
  768. * @param uint32_t addr : start address of lock region.
  769. *
  770. * @param uint32_t size : size of lock region.
  771. *
  772. * @return 0 for success
  773. * 1 for invalid argument
  774. */
  775. int Cache_Lock_Addr(uint32_t addr, uint32_t size);
  776. /**
  777. * @brief Unlock the cache items in tag memory for ICache or DCache.
  778. * Please do not call this function in your SDK application.
  779. *
  780. * @param uint32_t addr : start address of unlock region.
  781. *
  782. * @param uint32_t size : size of unlock region.
  783. *
  784. * @return 0 for success
  785. * 1 for invalid argument
  786. */
  787. int Cache_Unlock_Addr(uint32_t addr, uint32_t size);
  788. /**
  789. * @brief Disable ICache access for the cpu.
  790. * This operation will make all ICache tag memory invalid, CPU can't access ICache, ICache will keep idle.
  791. * Please do not call this function in your SDK application.
  792. *
  793. * @return uint32_t : auto preload enabled before
  794. */
  795. uint32_t Cache_Disable_ICache(void);
  796. /**
  797. * @brief Enable ICache access for the cpu.
  798. * Please do not call this function in your SDK application.
  799. *
  800. * @param uint32_t autoload : ICache will preload then.
  801. *
  802. * @return None
  803. */
  804. void Cache_Enable_ICache(uint32_t autoload);
  805. /**
  806. * @brief Disable DCache access for the cpu.
  807. * This operation will make all DCache tag memory invalid, CPU can't access DCache, DCache will keep idle
  808. * Please do not call this function in your SDK application.
  809. *
  810. * @return uint32_t : auto preload enabled before
  811. */
  812. uint32_t Cache_Disable_DCache(void);
  813. /**
  814. * @brief Enable DCache access for the cpu.
  815. * Please do not call this function in your SDK application.
  816. *
  817. * @param uint32_t autoload : DCache will preload then.
  818. *
  819. * @return None
  820. */
  821. void Cache_Enable_DCache(uint32_t autoload);
  822. /**
  823. * @brief Suspend ICache access for the cpu.
  824. * The ICache tag memory is still there, CPU can't access ICache, ICache will keep idle.
  825. * Please do not change MMU, cache mode or tag memory(tag memory can be changed in some special case).
  826. * Please do not call this function in your SDK application.
  827. *
  828. * @param None
  829. *
  830. * @return uint32_t : auto preload enabled before
  831. */
  832. uint32_t Cache_Suspend_ICache(void);
  833. /**
  834. * @brief Resume ICache access for the cpu.
  835. * Please do not call this function in your SDK application.
  836. *
  837. * @param uint32_t autoload : ICache will preload then.
  838. *
  839. * @return None
  840. */
  841. void Cache_Resume_ICache(uint32_t autoload);
  842. /**
  843. * @brief Suspend DCache access for the cpu.
  844. * The ICache tag memory is still there, CPU can't access DCache, DCache will keep idle.
  845. × Please do not change MMU, cache mode or tag memory(tag memory can be changed in some special case).
  846. * Please do not call this function in your SDK application.
  847. *
  848. * @param None
  849. *
  850. * @return uint32_t : auto preload enabled before
  851. */
  852. uint32_t Cache_Suspend_DCache(void);
  853. /**
  854. * @brief Resume DCache access for the cpu.
  855. * Please do not call this function in your SDK application.
  856. *
  857. * @param uint32_t autoload : DCache will preload then.
  858. *
  859. * @return None
  860. */
  861. void Cache_Resume_DCache(uint32_t autoload);
  862. /**
  863. * @brief Get ICache cache line size
  864. *
  865. * @param None
  866. *
  867. * @return uint32_t: 16, 32, 64 Byte
  868. */
  869. uint32_t Cache_Get_ICache_Line_Size(void);
  870. /**
  871. * @brief Get DCache cache line size
  872. *
  873. * @param None
  874. *
  875. * @return uint32_t: 16, 32, 64 Byte
  876. */
  877. uint32_t Cache_Get_DCache_Line_Size(void);
  878. /**
  879. * @brief Set default mode from boot, 8KB ICache, 16Byte cache line size.
  880. *
  881. * @param None
  882. *
  883. * @return None
  884. */
  885. void Cache_Set_Default_Mode(void);
  886. /**
  887. * @brief Set default mode from boot, 8KB ICache, 16Byte cache line size.
  888. *
  889. * @param None
  890. *
  891. * @return None
  892. */
  893. void Cache_Enable_Defalut_ICache_Mode(void);
  894. /**
  895. * @brief Occupy the cache items for DCache.
  896. * Operation will be done CACHE_LINE_SIZE aligned.
  897. * If the region is not in DCache addr room, nothing will be done.
  898. * Please do not call this function in your SDK application.
  899. *
  900. * @param uint32_t addr : start address of occupy region
  901. *
  902. * @param uint32_t items : cache lines to occupy, items * cache_line_size should not exceed the cache_size
  903. *
  904. * @return None
  905. */
  906. void Cache_Occupy_Items(uint32_t addr, uint32_t items);
  907. /**
  908. * @brief Occupy the cache addr for DCache.
  909. * Operation will be done CACHE_LINE_SIZE aligned.
  910. * If the region is not in DCache addr room, nothing will be done.
  911. * Please do not call this function in your SDK application.
  912. *
  913. * @param uint32_t addr : start address of occupy region
  914. *
  915. * @param uint32_t size : size of occupy region, size should not exceed the cache_size
  916. */
  917. int Cache_Occupy_Addr(uint32_t addr, uint32_t size);
  918. /**
  919. * @brief Enable freeze for ICache.
  920. * Any miss request will be rejected, including cpu miss and preload/autoload miss.
  921. * Please do not call this function in your SDK application.
  922. *
  923. * @param cache_freeze_mode_t mode : 0 for assert busy 1 for assert hit
  924. *
  925. * @return None
  926. */
  927. void Cache_Freeze_ICache_Enable(cache_freeze_mode_t mode);
  928. /**
  929. * @brief Disable freeze for ICache.
  930. * Please do not call this function in your SDK application.
  931. *
  932. * @return None
  933. */
  934. void Cache_Freeze_ICache_Disable(void);
  935. /**
  936. * @brief Enable freeze for DCache.
  937. * Any miss request will be rejected, including cpu miss and preload/autoload miss.
  938. * Please do not call this function in your SDK application.
  939. *
  940. * @param cache_freeze_mode_t mode : 0 for assert busy 1 for assert hit
  941. *
  942. * @return None
  943. */
  944. void Cache_Freeze_DCache_Enable(cache_freeze_mode_t mode);
  945. /**
  946. * @brief Disable freeze for DCache.
  947. * Please do not call this function in your SDK application.
  948. *
  949. * @return None
  950. */
  951. void Cache_Freeze_DCache_Disable(void);
  952. /**
  953. * @brief Travel tag memory to run a call back function.
  954. * ICache and DCache are suspend when doing this.
  955. * The callback will get the parameter tag_group_info, which will include a group of tag memory addresses and cache memory addresses.
  956. * Please do not call this function in your SDK application.
  957. *
  958. * @param struct cache_mode * mode : the cache to check and the cache mode.
  959. *
  960. * @param uint32_t filter_addr : only the cache lines which may include the filter_address will be returned to the call back function.
  961. * 0 for do not filter, all cache lines will be returned.
  962. *
  963. * @param void (* process)(struct tag_group_info *) : call back function, which may be called many times, a group(the addresses in the group are in the same position in the cache ways) a time.
  964. *
  965. * @return None
  966. */
  967. void Cache_Travel_Tag_Memory(struct cache_mode * mode, uint32_t filter_addr, void (* process)(struct tag_group_info *));
  968. /**
  969. * @brief Travel tag memory to run a call back function, using 2nd tag registers.
  970. * ICache and DCache are suspend when doing this.
  971. * The callback will get the parameter tag_group_info, which will include a group of tag memory addresses and cache memory addresses.
  972. * Please do not call this function in your SDK application.
  973. *
  974. * @param struct cache_mode * mode : the cache to check and the cache mode.
  975. *
  976. * @param uint32_t filter_addr : only the cache lines which may include the filter_address will be returned to the call back function.
  977. * 0 for do not filter, all cache lines will be returned.
  978. *
  979. * @param void (* process)(struct tag_group_info *) : call back function, which may be called many times, a group(the addresses in the group are in the same position in the cache ways) a time.
  980. *
  981. * @return None
  982. */
  983. void Cache_Travel_Tag_Memory2(struct cache_mode * mode, uint32_t filter_addr, void (* process)(struct tag_group_info *));
  984. /**
  985. * @brief Get the virtual address from cache mode, cache tag and the virtual address offset of cache ways.
  986. * Please do not call this function in your SDK application.
  987. *
  988. * @param struct cache_mode * mode : the cache to calculate the virtual address and the cache mode.
  989. *
  990. * @param uint32_t tag : the tag part fo a tag item, 12-14 bits.
  991. *
  992. * @param uint32_t addr_offset : the virtual address offset of the cache ways.
  993. *
  994. * @return uint32_t : the virtual address.
  995. */
  996. uint32_t Cache_Get_Virtual_Addr(struct cache_mode *mode, uint32_t tag, uint32_t vaddr_offset);
  997. /**
  998. * @brief Get cache memory block base address.
  999. * Please do not call this function in your SDK application.
  1000. *
  1001. * @param uint32_t icache : 0 for dcache, other for icache.
  1002. *
  1003. * @param uint32_t bank_no : 0 ~ 3 bank.
  1004. *
  1005. * @return uint32_t : the cache memory block base address, 0 if the block not used.
  1006. */
  1007. uint32_t Cache_Get_Memory_BaseAddr(uint32_t icache, uint32_t bank_no);
  1008. /**
  1009. * @brief Get the cache memory address from cache mode, cache memory offset and the virtual address offset of cache ways.
  1010. * Please do not call this function in your SDK application.
  1011. *
  1012. * @param struct cache_mode * mode : the cache to calculate the virtual address and the cache mode.
  1013. *
  1014. * @param uint32_t cache_memory_offset : the cache memory offset of the whole cache (ICache or DCache) for the cache line.
  1015. *
  1016. * @param uint32_t addr_offset : the virtual address offset of the cache ways.
  1017. *
  1018. * @return uint32_t : the virtual address.
  1019. */
  1020. uint32_t Cache_Get_Memory_Addr(struct cache_mode *mode, uint32_t cache_memory_offset, uint32_t vaddr_offset);
  1021. /**
  1022. * @brief Get the cache memory value by DRAM address.
  1023. * Please do not call this function in your SDK application.
  1024. *
  1025. * @param uint32_t cache_memory_addr : DRAM address for the cache memory, should be 4 byte aligned for IBus address.
  1026. *
  1027. * @return uint32_t : the word value of the address.
  1028. */
  1029. uint32_t Cache_Get_Memory_value(uint32_t cache_memory_addr);
  1030. /**
  1031. * @}
  1032. */
  1033. /**
  1034. * @brief Get the cache MMU IROM end address.
  1035. * Please do not call this function in your SDK application.
  1036. *
  1037. * @param void
  1038. *
  1039. * @return uint32_t : the word value of the address.
  1040. */
  1041. uint32_t Cache_Get_IROM_MMU_End(void);
  1042. /**
  1043. * @brief Get the cache MMU DROM end address.
  1044. * Please do not call this function in your SDK application.
  1045. *
  1046. * @param void
  1047. *
  1048. * @return uint32_t : the word value of the address.
  1049. */
  1050. uint32_t Cache_Get_DROM_MMU_End(void);
  1051. /**
  1052. * @brief Used by SPI flash mmap
  1053. *
  1054. */
  1055. int flash2spiram_instruction_offset(void);
  1056. int flash2spiram_rodata_offset(void);
  1057. uint32_t flash_instr_rodata_start_page(uint32_t bus);
  1058. uint32_t flash_instr_rodata_end_page(uint32_t bus);
  1059. extern struct cache_internal_stub_table* rom_cache_internal_table_ptr;
  1060. extern cache_op_cb_t rom_cache_op_cb;
  1061. #ifdef __cplusplus
  1062. }
  1063. #endif