Skip to content

Commit b66aa27

Browse files
committed
feat(Other): Add Zephyr ICC wrapper functions
Introduce ICC wrapper functions to integrate with Zephyr. Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
1 parent 83bf73c commit b66aa27

2 files changed

Lines changed: 136 additions & 0 deletions

File tree

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
/******************************************************************************
2+
*
3+
* Copyright (C) 2026 Analog Devices, Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
******************************************************************************/
18+
19+
#ifndef LIBRARIES_ZEPHYR_MAX_INCLUDE_WRAP_MAX32_ICC_H_
20+
#define LIBRARIES_ZEPHYR_MAX_INCLUDE_WRAP_MAX32_ICC_H_
21+
22+
/* Includes */
23+
#include <icc.h>
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
/*
30+
* SoCs with per-instance ICC API: MXC_ICC_* take an `mxc_icc_regs_t *icc`.
31+
* Call the per-instance functions directly.
32+
*/
33+
#if defined(CONFIG_SOC_MAX32655) || defined(CONFIG_SOC_MAX32680) || \
34+
defined(CONFIG_SOC_MAX32690) || defined(CONFIG_SOC_MAX78000) || defined(CONFIG_SOC_MAX78002)
35+
36+
static inline void Wrap_MXC_ICC_Enable(mxc_icc_regs_t *icc)
37+
{
38+
MXC_ICC_Enable(icc);
39+
}
40+
41+
static inline void Wrap_MXC_ICC_Disable(mxc_icc_regs_t *icc)
42+
{
43+
MXC_ICC_Disable(icc);
44+
}
45+
46+
static inline void Wrap_MXC_ICC_Flush(mxc_icc_regs_t *icc)
47+
{
48+
MXC_ICC_Flush(icc);
49+
}
50+
51+
static inline void Wrap_MXC_ICC_Invalidate(mxc_icc_regs_t *icc)
52+
{
53+
MXC_ICC_Invalidate(icc);
54+
}
55+
56+
static inline void Wrap_MXC_ICC_WaitForReady(mxc_icc_regs_t *icc)
57+
{
58+
MXC_ICC_WaitForReady(icc);
59+
}
60+
61+
/*
62+
* SoCs that expose both global and instance APIs (use instance API when
63+
* available). These SoCs provide MXC_ICC_*Inst() functions.
64+
*/
65+
#elif defined(CONFIG_SOC_MAX32650) || defined(CONFIG_SOC_MAX32665) || defined(CONFIG_SOC_MAX32666)
66+
67+
static inline void Wrap_MXC_ICC_Enable(mxc_icc_regs_t *icc)
68+
{
69+
MXC_ICC_EnableInst(icc);
70+
}
71+
72+
static inline void Wrap_MXC_ICC_Disable(mxc_icc_regs_t *icc)
73+
{
74+
MXC_ICC_DisableInst(icc);
75+
}
76+
77+
static inline void Wrap_MXC_ICC_Flush(mxc_icc_regs_t *icc)
78+
{
79+
MXC_ICC_FlushInst(icc);
80+
}
81+
82+
static inline void Wrap_MXC_ICC_Invalidate(mxc_icc_regs_t *icc)
83+
{
84+
MXC_ICC_InvalidateInst(icc);
85+
}
86+
87+
static inline void Wrap_MXC_ICC_WaitForReady(mxc_icc_regs_t *icc)
88+
{
89+
/* Prefer instance variant when present */
90+
MXC_ICC_WaitForReadyInst(icc);
91+
}
92+
93+
/*
94+
* SoCs with only global ICC API (no per-instance functions).
95+
* Ignore the `icc` parameter and call the global functions.
96+
*/
97+
#else
98+
99+
static inline void Wrap_MXC_ICC_Enable(mxc_icc_regs_t *icc)
100+
{
101+
(void)icc;
102+
MXC_ICC_Enable();
103+
}
104+
105+
static inline void Wrap_MXC_ICC_Disable(mxc_icc_regs_t *icc)
106+
{
107+
(void)icc;
108+
MXC_ICC_Disable();
109+
}
110+
111+
static inline void Wrap_MXC_ICC_Flush(mxc_icc_regs_t *icc)
112+
{
113+
(void)icc;
114+
MXC_ICC_Flush();
115+
}
116+
117+
static inline void Wrap_MXC_ICC_Invalidate(mxc_icc_regs_t *icc)
118+
{
119+
(void)icc;
120+
MXC_ICC_Invalidate();
121+
}
122+
123+
static inline void Wrap_MXC_ICC_WaitForReady(mxc_icc_regs_t *icc)
124+
{
125+
(void)icc;
126+
MXC_ICC_WaitForReady();
127+
}
128+
129+
#endif // SOC selection
130+
131+
#ifdef __cplusplus
132+
}
133+
#endif
134+
135+
#endif // LIBRARIES_ZEPHYR_MAX_INCLUDE_WRAP_MAX32_ICC_H_

Libraries/zephyr/MAX/Source/MAX32657/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ zephyr_library_sources(
6464

6565
${MSDK_PERIPH_SRC_DIR}/ICC/icc_me30.c
6666
${MSDK_PERIPH_SRC_DIR}/ICC/icc_reva.c
67+
${MSDK_PERIPH_SRC_DIR}/ICC/icc_common.c
6768

6869
${MSDK_PERIPH_SRC_DIR}/LP/lp_me30.c
6970

0 commit comments

Comments
 (0)