1 /*
2  * Copyright 2022 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef _FSL_CACHE_H_
9 #define _FSL_CACHE_H_
10 
11 #include "fsl_common.h"
12 
13 /*!
14  * @addtogroup cache_armv8a
15  * @{
16  */
17 
18 /*******************************************************************************
19  * Definitions
20  ******************************************************************************/
21 
22 /*! @name Driver version */
23 /*@{*/
24 /*! @brief cache driver version 1.0.0. */
25 #define FSL_CACHE_DRIVER_VERSION (MAKE_VERSION(1, 0, 0))
26 /*@}*/
27 
28 /*******************************************************************************
29  * API
30  ******************************************************************************/
31 
32 #if defined(__cplusplus)
33 extern "C" {
34 #endif
35 
36 
37 /*!
38  * @name Unified Cache Control for all caches
39  * Mainly used for many drivers for easy cache operation.
40  *@{
41  */
42 
43 /*!
44  * brief Invalidates all instruction caches by range.
45  *
46  * param address The virtual address.
47  * param size_byte size of the memory to be invalidated.
48  */
49 void ICACHE_InvalidateByRange(uintptr_t address, size_t size_byte);
50 
51 /*!
52  * brief Invalidates all data caches by range.
53  *
54  * param address The virtual address.
55  * param size_byte size of the memory to be invalidated.
56  */
57 void DCACHE_InvalidateByRange(uintptr_t address, size_t size_byte);
58 
59 /*!
60  * brief Cleans all data caches by range.
61  *
62  * param address The virtual address.
63  * param size_byte size of the memory to be cleaned.
64  */
65 void DCACHE_CleanByRange(uintptr_t address, size_t size_byte);
66 
67 /*!
68  * brief Cleans and Invalidates all data caches by range.
69  *
70  * param address The virtual address.
71  * param size_byte size of the memory to be cleaned and invalidated.
72  */
73 void DCACHE_CleanInvalidateByRange(uintptr_t address, size_t size_byte);
74 
75 /*@}*/
76 
77 #if defined(__cplusplus)
78 }
79 #endif
80 
81 /*! @}*/
82 
83 #endif /* _FSL_CACHE_H_*/
84