1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
/*
* Copyright 2016-2020 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _FSL_CACHE_H_
#define _FSL_CACHE_H_
#include "fsl_common.h"
/*!
* @addtogroup cache_lpcac
* @{
*/
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @name Driver version */
/*@{*/
/*! @brief cache driver version 2.1.1. */
#define FSL_CACHE_DRIVER_VERSION (MAKE_VERSION(2, 1, 1))
/*@}*/
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/*!
* @name cache control for the L1 low power cache controller
*@{
*/
/*!
* @brief Enables the processor code bus cache.
*
*/
static inline void L1CACHE_EnableCodeCache(void)
{
MCM->CPCR2 &= ~MCM_CPCR2_DCBC_MASK;
}
/*!
* @brief Disables the processor code bus cache.
*
*/
static inline void L1CACHE_DisableCodeCache(void)
{
MCM->CPCR2 |= MCM_CPCR2_DCBC_MASK;
}
/*!
* @brief Invalidates the processor code bus cache.
*
*/
static inline void L1CACHE_InvalidateCodeCache(void)
{
MCM->CPCR2 |= MCM_CPCR2_CCBC_MASK;
}
/*@}*/
/*!
* @name The unified L1 cache controller
* The LPCAC is write-through design, so there is no cache maintain by range
* control operation. So all cache maintain by range unified functions
* are directly call the cache maintain all functions since they have the same effect.
*@{
*/
/*!
* @brief Invalidates L1 instrument cache by range.
*
* @param address The start address of the memory to be invalidated.
* @param size_byte The memory size.
*/
void L1CACHE_InvalidateICacheByRange(uint32_t address, uint32_t size_byte);
/*!
* @brief Invalidates L1 data cache by range.
*
* @param address The start address of the memory to be invalidated.
* @param size_byte The memory size.
*/
static inline void L1CACHE_InvalidateDCacheByRange(uint32_t address, uint32_t size_byte)
{
L1CACHE_InvalidateICacheByRange(address, size_byte);
}
/*!
* @brief Cleans L1 data cache by range.
*
* The cache is write through mode, so there is nothing to do with
* the cache flush/clean operation.
*
* @param address The start address of the memory to be cleaned.
* @param size_byte The memory size.
*/
static inline void L1CACHE_CleanDCacheByRange(uint32_t address, uint32_t size_byte)
{
}
/*!
* @brief Cleans and Invalidates L1 data cache by range.
*
* @param address The start address of the memory to be clean and invalidated.
* @param size_byte The memory size.
*/
static inline void L1CACHE_CleanInvalidateDCacheByRange(uint32_t address, uint32_t size_byte)
{
L1CACHE_InvalidateDCacheByRange(address, size_byte);
}
/*@}*/
/*!
* @name Unified Cache Control for caches in all levels
*@{
*/
/*!
* @brief Invalidates instruction cache by range.
*
* @param address The physical address.
* @param size_byte size of the memory to be invalidated.
*/
static inline void ICACHE_InvalidateByRange(uint32_t address, uint32_t size_byte)
{
L1CACHE_InvalidateICacheByRange(address, size_byte);
}
/*!
* @brief Invalidates data cache by range.
*
* @param address The physical address.
* @param size_byte size of the memory to be invalidated.
*/
static inline void DCACHE_InvalidateByRange(uint32_t address, uint32_t size_byte)
{
L1CACHE_InvalidateDCacheByRange(address, size_byte);
}
/*!
* @brief Clean data cache by range.
*
* @param address The physical address.
* @param size_byte size of the memory to be cleaned.
*/
static inline void DCACHE_CleanByRange(uint32_t address, uint32_t size_byte)
{
L1CACHE_CleanDCacheByRange(address, size_byte);
}
/*!
* @brief Cleans and Invalidates data cache by range.
*
* @param address The physical address.
* @param size_byte size of the memory to be Cleaned and Invalidated.
*/
static inline void DCACHE_CleanInvalidateByRange(uint32_t address, uint32_t size_byte)
{
L1CACHE_CleanInvalidateDCacheByRange(address, size_byte);
}
/*@}*/
#if defined(__cplusplus)
}
#endif
/*! @}*/
#endif /* _FSL_CACHE_H_*/
|