1 /**
2  * @file    srcc.h
3  * @brief   This file contains all functions prototypes and data types for the
4  *          External Memory Cache Controller (SRCC) driver
5  */
6 
7 /******************************************************************************
8  *
9  * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
10  * Analog Devices, Inc.),
11  * Copyright (C) 2023-2024 Analog Devices, Inc.
12  *
13  * Licensed under the Apache License, Version 2.0 (the "License");
14  * you may not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  *     http://www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS,
21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  *
25  ******************************************************************************/
26 
27 #ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32570_SRCC_H_
28 #define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32570_SRCC_H_
29 
30 /***** Includes *****/
31 #include "srcc_regs.h"
32 #include "mxc_device.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /**
39  * @defgroup srcc SPIX Cache Controller (SRCC)
40  * @ingroup periphlibs
41  * @{
42  */
43 
44 /***** Definitions *****/
45 
46 /**
47  * @brief   Enumeration type for the SRCC Cache ID Register
48  */
49 typedef enum {
50     SRCC_CACHE_ID_RELNUM, ///< Release Number
51     SRCC_CACHE_ID_PARTNUM, ///< Part Number
52     SRCC_CACHE_ID_CCHID ///< Cache ID
53 } mxc_srcc_cache_id_t;
54 
55 /***** Function Prototypes *****/
56 
57 /**
58  * @brief   Reads the data from the SRCC Cache ID Register
59  * @param   id      Enumeration type for the SRCC Cache ID Register
60  * @returns The contents of SRCC cache ID Register
61  */
62 uint32_t MXC_SRCC_ID(mxc_srcc_cache_id_t id);
63 
64 /**
65  * @brief   Gets the cache size in Kbytes. The default value is 16KB.
66  * @returns Cache size, in Kbytes
67  */
68 uint32_t MXC_SRCC_CacheSize(void);
69 
70 /**
71  * @brief   Gets the main memory size in units of 128KB. The default value is 512MB.
72  * @returns Main memory size, in units of 128KB
73  */
74 uint32_t MXC_SRCC_MemSize(void);
75 
76 /**
77  * @brief   Enables the data cache controller
78  */
79 void MXC_SRCC_Enable(void);
80 
81 /**
82  * @brief   Disables the data cache controller
83  */
84 void MXC_SRCC_Disable(void);
85 
86 /**
87  * @brief   Flushes the data cache controller
88  */
89 void MXC_SRCC_Flush(void);
90 
91 /**
92  * @brief   Enables write-allocate mode with data cache controller
93  */
94 void MXC_SRCC_WriteAllocEnable(void);
95 
96 /**
97  * @brief   Disables write-allocate mode with data cache controller
98  */
99 void MXC_SRCC_WriteAllocDisable(void);
100 
101 /**
102  * @brief   Enables critical-word-first mode with data cache controller
103  */
104 void MXC_SRCC_CriticalWordFirstEnable(void);
105 
106 /**
107  * @brief   Disables critical-word-first mode with data cache controller
108  */
109 void MXC_SRCC_CriticalWordFirstDisable(void);
110 
111 /**
112  * @brief   Reads the SRCC Cache ready flag, which is set and cleared by hardware
113  * @returns SRCC Cache ready flag
114  */
115 uint32_t MXC_SRCC_Ready(void);
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32570_SRCC_H_
122 /**
123  * @} srcc
124  */
125