Introduction to cache operation interface of Allwinner V85 development board RTOS platform
[Copy link]
## 1. Topic
Introduction to cache operation interface of Allwinner F series/R series/V series RTOS platform
## 2. Problem Background
The RTOS used by Allwinner F series/R series/V series provides some cache operation interfaces for use when different masters read and write data in memory. The following is an introduction to the use of cache operation interfaces.
* **hal_dcache_clean**
Function prototype: void hal_dcache_clean(unsigned long addr, int len);
Function purpose: flush the data corresponding to the address [addr, addr + len] on the dcache back to the memory, and the data on the dcache is still valid.
Usage scenario: when providing data to peripherals, the data on the dcache needs to be written back to the memory so that the peripherals can directly access the memory to obtain the data (the peripheral access will not go through the dcache).
* **hal_dcache_invalidate**
Function prototype: void hal_dcache_invalidate(unsigned long addr, int len);
Function purpose: invalidate the data corresponding to the address [addr, addr + len] on the dcache.
Usage scenario: After the peripheral modifies the data, the CPU needs to invalidate the data on the dcache so that the CPU can obtain the data modified by the peripheral.
* **hal_dcache_clean_all**
Function prototype: void hal_dcache_clean_all(void);
Function function: flush all dcache data.
Usage scenario: rarely used, generally used in the scenario of dynamically closing Dcache.
* **hal_dcache_invalidate_all**
Function prototype: void hal_dcache_invalidate_all(void);
Function purpose: invalidate all dcache data.
Usage scenario: Except for the scenario of enabling dcache, it is absolutely not allowed to be used.
* **hal_icache_invalidate**
Function prototype: void hal_icache_invalidate(unsigned long addr, int len);
Function purpose: invalidate the data corresponding to the address [addr, addr + len] on icache.
Usage scenario: When self-modifying code instructions, it is necessary to invalidate icache.
* **hal_icache_invalidate_all**
Function prototype: void hal_icache_invalidate_all(void);
Function purpose: invalidate all dcache data.
Usage scenario: invalidate icache when self-modifying code instructions.
|