• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *   Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
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  * Description: OS Abstract Layer.
15  */
16 
17 /**
18  * @defgroup osal_cache osal_cache
19  */
20 #ifndef OSAL_CAHCE_H
21 #define OSAL_CAHCE_H
22 
23 #ifdef __cplusplus
24 #if __cplusplus
25 extern "C" {
26 #endif
27 #endif
28 
29 /**
30  * @ingroup osal_cache
31  * @brief flush DCache.
32  *
33  * @par Description:
34  * This API is used to flush DCache.
35  *
36  * @attention
37  * The base address will be aligned to CACHE_LINE_SIZE(32Bytes) if it's not aligned to CACHE_LINE_SIZE.
38  * Make sure that phys_addr is valid when mmu does not exist, and user set its addr in kvirt.
39  *
40  * @param  kvirt [in] kvirt.
41  * @param  phys_addr [in] The start address need flush.
42  * @param  size [in] The size of flush memory.
43  *
44  * @par Support System:
45  * linux liteos seliteos.
46  */
47 void osal_dcache_region_wb(void *kvirt, unsigned long phys_addr, unsigned long size);
48 
49 /**
50  * @ingroup osal_cache
51  * @brief invalid DCache.
52  *
53  * @par Description:
54  * This API is used to invalid DCache.
55  *
56  * @attention
57  * The base address will be aligned to CACHE_LINE_SIZE(32Bytes) if it's not aligned to CACHE_LINE_SIZE.
58  *
59  * @param  addr [in] The start address need flush.
60  * @param  size [in] The size of flush memory.
61  *
62  * @par Support System:
63  * linux liteos seliteos.
64  */
65 void osal_dcache_region_inv(void *addr, unsigned long size);
66 
67 /**
68  * @ingroup osal_cache
69  * @brief clean DCache.
70  *
71  * @par Description:
72  * This API is used to clean DCache.
73  *
74  * @par Support System:
75  * liteos.
76  */
77 void osal_dcache_region_clean(void *addr, unsigned int size);
78 
79 /**
80  * @ingroup osal_cache
81  * @brief flush DCache.
82  *
83  * @par Description:
84  * This API is used to flush DCache.
85  *
86  * @par Support System:
87  * seliteos.
88  */
89 void osal_arch_dcache_flush_by_va(void *base_addr, unsigned int size);
90 
91 /**
92  * @ingroup osal_cache
93  * @brief invalid DCache.
94  *
95  * @par Description:
96  * This API is used to invalid DCache.
97  *
98  * @par Support System:
99  * seliteos.
100  */
101 void osal_arch_dcahce_inv_by_va(void *base_addr, unsigned int size);
102 
103 #ifdef __cplusplus
104 #if __cplusplus
105 }
106 #endif
107 #endif
108 #endif /* __OSAL_CAHCE_H__ */