Skip to content

Commit c343ed9

Browse files
committed
Update Zephyr MSDK Hal based on MSDK PR: analogdevicesinc/msdk#1305
1 parent 17499af commit c343ed9

File tree

4 files changed

+126
-1
lines changed

4 files changed

+126
-1
lines changed

MAX/Include/wrap_max32_can.h

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/******************************************************************************
2+
*
3+
* Copyright (C) 2024 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_CAN_H_
20+
#define LIBRARIES_ZEPHYR_MAX_INCLUDE_WRAP_MAX32_CAN_H_
21+
22+
/***** Includes *****/
23+
#include <can.h>
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
static inline void Wrap_MXC_CAN_Init(uint32_t can_idx, mxc_can_obj_cfg_t cfg,
30+
mxc_can_unit_event_cb_t unit_cb,
31+
mxc_can_object_event_cb_t obj_cb)
32+
{
33+
/* The only API difference between the MAX32662 and MAX32690 relevant to
34+
* implementing the max32 CAN driver in Zephyr is that the former requires a
35+
* GPIO mapping parameter, which is not used anyway (MSDK_NO_GPIO_CLK_INIT).
36+
*/
37+
38+
/* MAX32662 related mapping */
39+
#if defined(CONFIG_SOC_MAX32662)
40+
/* A value of -1 is invalid, will configure no GPIOs, but still pass through
41+
* to MXC_CAN_RevA_Init, even in case MSDK_NO_GPIO_CLK_INIT wasn't set.
42+
*/
43+
MXC_CAN_Init(can_idx, cfg, unit_cb, obj_cb, -1);
44+
45+
/* MAX32690 related mapping */
46+
#elif defined(CONFIG_SOC_MAX32690)
47+
MXC_CAN_Init(can_idx, cfg, unit_cb, obj_cb);
48+
49+
#endif // part number
50+
}
51+
52+
#ifdef __cplusplus
53+
}
54+
#endif
55+
56+
#endif // LIBRARIES_ZEPHYR_MAX_INCLUDE_WRAP_MAX32_CAN_H_

MAX/Include/wrap_max32_dma.h

+10
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ static inline int Wrap_MXC_DMA_AcquireChannel(mxc_dma_regs_t *dma)
8787
#endif
8888
}
8989

90+
static inline int Wrap_MXC_DMA_GetChannelIndex(mxc_dma_regs_t *dma, uint8_t ch)
91+
{
92+
#if defined(CONFIG_SOC_MAX32657)
93+
(void)dma;
94+
return ch;
95+
#else
96+
return (ch + MXC_DMA_GET_IDX(dma) * (MXC_DMA_CHANNELS / MXC_DMA_INSTANCES));
97+
#endif
98+
}
99+
90100
static inline void Wrap_MXC_DMA_Handler(mxc_dma_regs_t *dma)
91101
{
92102
#if defined(CONFIG_SOC_MAX32657) || defined(CONFIG_SOC_MAX32665) || defined(CONFIG_SOC_MAX32666)

MAX/Include/wrap_max32_usb.h

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/******************************************************************************
2+
*
3+
* Copyright (C) 2024 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_USB_H_
20+
#define LIBRARIES_ZEPHYR_MAX_INCLUDE_WRAP_MAX32_USB_H_
21+
22+
/***** Includes *****/
23+
#include <usb.h>
24+
#include <usb_event.h>
25+
#include <mcr_regs.h>
26+
27+
#ifdef __cplusplus
28+
extern "C" {
29+
#endif
30+
31+
/*
32+
* MAX32665, MAX32666 related mapping
33+
*/
34+
#if defined(CONFIG_SOC_MAX32665) || (CONFIG_SOC_MAX32666)
35+
36+
static inline int Wrap_MXC_USB_Init(maxusb_cfg_options_t *options)
37+
{
38+
return MXC_USB_Init(options);
39+
}
40+
41+
/*
42+
* MAX32690 related mapping
43+
*/
44+
#elif defined(CONFIG_SOC_MAX32690)
45+
46+
static inline int Wrap_MXC_USB_Init(maxusb_cfg_options_t *options)
47+
{
48+
MXC_MCR->ldoctrl |= MXC_F_MCR_LDOCTRL_0P9EN;
49+
50+
return MXC_USB_Init(options);
51+
}
52+
53+
#endif // part number
54+
55+
#ifdef __cplusplus
56+
}
57+
#endif
58+
59+
#endif // LIBRARIES_ZEPHYR_MAX_INCLUDE_WRAP_MAX32_USB_H_

MAX/msdk_sha

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b1e26c4a3111763c9663691ed7455739665da5e3
1+
506501c5caba0fd4d331c65449545fb5e17de089

0 commit comments

Comments
 (0)