1 /**
2  * Copyright 2017 Maxim Integrated Products, Inc.,
3  * All Rights Reserved.</center></h2>
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
19  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21  * OTHER DEALINGS IN THE SOFTWARE.
22  *
23  * Except as contained in this notice, the name of Maxim Integrated
24  * Products, Inc. shall not be used except as stated in the Maxim Integrated
25  * Products, Inc. Branding Policy.
26  *
27  * The mere transfer of this software does not imply any licenses
28  * of trade secrets, proprietary technology, copyrights, patents,
29  * trademarks, maskwork rights, or any other form of intellectual
30  * property whatsoever. Maxim Integrated Products, Inc. retains all
31  * ownership rights.
32  *
33  *
34  ********************************************************************************
35 */
36 
37 /*
38  ******************************************************************************
39  * @file
40  * @addtogroup emcc External Memory Cache Controller (EMCC)
41  * @{
42  * @brief   This file contains all functions prototypes and data types for the
43  *          External Memory Cache Controller (EMCC) driver
44  ******************************************************************************
45 */
46 
47 #ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32690_EMCC_H_
48 #define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32690_EMCC_H_
49 
50 /***** Includes *****/
51 #include "emcc_regs.h"
52 #include "mxc_device.h"
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 /***** Definitions *****/
59 
60 /**
61  * Enumeration type for the EMCC Cache ID Register
62  */
63 typedef enum {
64     EMCC_INFO_RELNUM, // Release Number
65     EMCC_INFO_PARTNUM, // Part Number
66     EMCC_INFO_ID // Cache ID
67 } mxc_emcc_info_t;
68 
69 /***** Function Prototypes *****/
70 
71 /**
72  * @brief   Reads the data from the EMCC Cache ID Register
73  * @param   id      Enumeration type for the EMCC Cache ID Register
74  * @returns The contents of EMCC cache ID Register
75  */
76 uint32_t MXC_EMCC_ID(mxc_emcc_info_t id);
77 
78 /**
79  * @brief   Gets the cache size in Kbytes. The default value is 16KB.
80  * @returns Cache size, in Kbytes
81  */
82 uint32_t MXC_EMCC_CacheSize(void);
83 
84 /**
85  * @brief   Gets the main memory size in units of 128KB. The default value is 512MB.
86  * @returns Main memory size, in units of 128KB
87  */
88 uint32_t MXC_EMCC_MemSize(void);
89 
90 /**
91  * @brief   Enables the data cache controller
92  */
93 void MXC_EMCC_Enable(void);
94 
95 /**
96  * @brief   Disables the data cache controller
97  */
98 void MXC_EMCC_Disable(void);
99 
100 /**
101  * @brief   Flushes the data cache controller
102  */
103 void MXC_EMCC_Flush(void);
104 
105 /**
106  * @brief   Enables write-allocate mode with data cache controller
107  */
108 void MXC_EMCC_WriteAllocEnable(void);
109 
110 /**
111  * @brief   Disables write-allocate mode with data cache controller
112  */
113 void MXC_EMCC_WriteAllocDisable(void);
114 
115 /**
116  * @brief   Enables critical-word-first mode with data cache controller
117  */
118 void MXC_EMCC_CriticalWordFirstEnable(void);
119 
120 /**
121  * @brief   Disables critical-word-first mode with data cache controller
122  */
123 void MXC_EMCC_CriticalWordFirstDisable(void);
124 
125 /**
126  * @brief   Reads the EMCC Cache ready flag, which is set and cleared by hardware
127  * @returns EMCC Cache ready flag
128  */
129 uint32_t MXC_EMCC_Ready(void);
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32690_EMCC_H_
136 /**
137  * @}
138  */
139