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