Skip to content

Commit

Permalink
Update Zephyr MSDK Hal based on MSDK PR: analogdevicesinc/msdk#1027
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jun 5, 2024
1 parent c54d7fc commit 08157ac
Show file tree
Hide file tree
Showing 211 changed files with 52,040 additions and 574 deletions.
1 change: 1 addition & 0 deletions MAX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ add_subdirectory_ifdef(CONFIG_SOC_MAX32570 Source/MAX32570)
add_subdirectory_ifdef(CONFIG_SOC_MAX32572 Source/MAX32572)
add_subdirectory_ifdef(CONFIG_SOC_MAX32650 Source/MAX32650)
add_subdirectory_ifdef(CONFIG_SOC_MAX32655 Source/MAX32655)
add_subdirectory_ifdef(CONFIG_SOC_MAX32657 Source/MAX32657)
add_subdirectory_ifdef(CONFIG_SOC_MAX32660 Source/MAX32660)
add_subdirectory_ifdef(CONFIG_SOC_MAX32662 Source/MAX32662)
add_subdirectory_ifdef(CONFIG_SOC_MAX32665 Source/MAX32665)
Expand Down
90 changes: 39 additions & 51 deletions MAX/Include/wrap_max32_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@
extern "C" {
#endif

/*
* MAX32665, MAX32666 related mapping
*/
#if defined(CONFIG_SOC_MAX32665) || (CONFIG_SOC_MAX32666)

#define ADI_MAX32_DMA_CTRL_DIS_IE MXC_F_DMA_CFG_CHDIEN
#define ADI_MAX32_DMA_CTRL_CTZIEN MXC_F_DMA_CFG_CTZIEN

Expand All @@ -40,52 +36,7 @@ extern "C" {
#define ADI_MAX32_DMA_STATUS_ST MXC_F_DMA_ST_CH_ST

#define ADI_MAX32_DMA_CFG_REQ_POS MXC_F_DMA_CFG_REQSEL_POS

static inline int MXC_DMA_GetIntFlags(mxc_dma_regs_t *dma)
{
return dma->intr;
}

static inline int Wrap_MXC_DMA_Init(mxc_dma_regs_t *dma)
{
return MXC_DMA_Init(dma);
}

static inline void Wrap_MXC_DMA_DeInit(mxc_dma_regs_t *dma)
{
MXC_DMA_DeInit(dma);
}

static inline int Wrap_MXC_DMA_AcquireChannel(mxc_dma_regs_t *dma)
{
return MXC_DMA_AcquireChannel(dma);
}

static inline void Wrap_MXC_DMA_Handler(mxc_dma_regs_t *dma)
{
MXC_DMA_Handler(dma);
}

static inline int Wrap_MXC_DMA_MemCpy(mxc_dma_regs_t *dma, void *dest, void *src, int len,
mxc_dma_complete_cb_t callback)
{
return MXC_DMA_MemCpy(dma, dest, src, len, callback);
}

static inline int Wrap_MXC_DMA_DoTransfer(mxc_dma_regs_t *dma, mxc_dma_config_t config,
mxc_dma_srcdst_t firstSrcDst,
mxc_dma_trans_chain_t callback)
{
return MXC_DMA_DoTransfer(dma, config, firstSrcDst, callback);
}

/*
* MAX32690, MAX32655 related mapping
*/
#elif defined(CONFIG_SOC_MAX32690) || (CONFIG_SOC_MAX32655) || (CONFIG_SOC_MAX32670) || \
(CONFIG_SOC_MAX32672) || (CONFIG_SOC_MAX32662) || (CONFIG_SOC_MAX32675) || \
(CONFIG_SOC_MAX32680)

#else
#define ADI_MAX32_DMA_CTRL_DIS_IE MXC_F_DMA_CTRL_DIS_IE
#define ADI_MAX32_DMA_CTRL_CTZIEN MXC_F_DMA_CTRL_CTZ_IE

Expand All @@ -95,52 +46,89 @@ static inline int Wrap_MXC_DMA_DoTransfer(mxc_dma_regs_t *dma, mxc_dma_config_t
#define ADI_MAX32_DMA_STATUS_ST MXC_F_DMA_STATUS_STATUS

#define ADI_MAX32_DMA_CFG_REQ_POS MXC_F_DMA_CTRL_REQUEST_POS
#endif

static inline int MXC_DMA_GetIntFlags(mxc_dma_regs_t *dma)
{
#if defined(CONFIG_SOC_MAX32665) || (CONFIG_SOC_MAX32666)
return dma->intr;
#else
return dma->intfl;
#endif
}

static inline int Wrap_MXC_DMA_Init(mxc_dma_regs_t *dma)
{
#if defined(CONFIG_SOC_MAX32657) || (CONFIG_SOC_MAX32665) || (CONFIG_SOC_MAX32666)
return MXC_DMA_Init(dma);
#else
(void)dma;
return MXC_DMA_Init();
#endif
}

static inline void Wrap_MXC_DMA_DeInit(mxc_dma_regs_t *dma)
{
#if defined(CONFIG_SOC_MAX32657) || (CONFIG_SOC_MAX32665) || (CONFIG_SOC_MAX32666)
MXC_DMA_DeInit(dma);
#else
(void)dma;
MXC_DMA_DeInit();
#endif
}

static inline int Wrap_MXC_DMA_AcquireChannel(mxc_dma_regs_t *dma)
{
#if defined(CONFIG_SOC_MAX32657) || (CONFIG_SOC_MAX32665) || (CONFIG_SOC_MAX32666)
return MXC_DMA_AcquireChannel(dma);
#else
(void)dma;
return MXC_DMA_AcquireChannel();
#endif
}

static inline void Wrap_MXC_DMA_Handler(mxc_dma_regs_t *dma)
{
#if defined(CONFIG_SOC_MAX32657) || (CONFIG_SOC_MAX32665) || (CONFIG_SOC_MAX32666)
MXC_DMA_Handler(dma);
#else
(void)dma;
MXC_DMA_Handler();
#endif
}

static inline int Wrap_MXC_DMA_MemCpy(mxc_dma_regs_t *dma, void *dest, void *src, int len,
mxc_dma_complete_cb_t callback)
{
#if defined(CONFIG_SOC_MAX32657) || (CONFIG_SOC_MAX32665) || (CONFIG_SOC_MAX32666)
return MXC_DMA_MemCpy(dma, dest, src, len, callback);
#else
(void)dma;
return MXC_DMA_MemCpy(dest, src, len, callback);
#endif
}

static inline int Wrap_MXC_DMA_DoTransfer(mxc_dma_regs_t *dma, mxc_dma_config_t config,
mxc_dma_srcdst_t firstSrcDst,
mxc_dma_trans_chain_t callback)
{
#if defined(CONFIG_SOC_MAX32657) || (CONFIG_SOC_MAX32665) || (CONFIG_SOC_MAX32666)
return MXC_DMA_DoTransfer(dma, config, firstSrcDst, callback);
#else
(void)dma;
return MXC_DMA_DoTransfer(config, firstSrcDst, callback);
#endif
}

#endif // part number
static inline int Wrap_MXC_DMA_EnableInt(mxc_dma_regs_t *dma, int ch)
{
#if defined(CONFIG_SOC_MAX32657)
return MXC_DMA_EnableInt(dma, ch);
#else
(void)dma;
return MXC_DMA_EnableInt(ch);
#endif
}

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion MAX/Include/wrap_max32_i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static inline void Wrap_MXC_I2C_Stop(mxc_i2c_regs_t *i2c)
*/
#elif defined(CONFIG_SOC_MAX32690) || (CONFIG_SOC_MAX32655) || (CONFIG_SOC_MAX32670) || \
(CONFIG_SOC_MAX32672) || (CONFIG_SOC_MAX32662) || (CONFIG_SOC_MAX32675) || \
(CONFIG_SOC_MAX32680)
(CONFIG_SOC_MAX32680) || (CONFIG_SOC_MAX32657)
/*
* Control register bits
*/
Expand Down
3 changes: 2 additions & 1 deletion MAX/Include/wrap_max32_lp.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ static inline void Wrap_MXC_LP_EnterPowerDownMode(void)
/*
* MAX32690, MAX32655 related mapping
*/
#elif defined(CONFIG_SOC_MAX32690) || (CONFIG_SOC_MAX32655) || (CONFIG_SOC_MAX32680)
#elif defined(CONFIG_SOC_MAX32690) || (CONFIG_SOC_MAX32655) || (CONFIG_SOC_MAX32680) || \
(CONFIG_SOC_MAX32657)

static inline void Wrap_MXC_LP_EnterLowPowerMode(void)
{
Expand Down
2 changes: 1 addition & 1 deletion MAX/Include/wrap_max32_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static inline int Wrap_MXC_SPI_Init(mxc_spi_regs_t *spi, int masterMode, int qua
*/
#elif defined(CONFIG_SOC_MAX32690) || (CONFIG_SOC_MAX32655) || (CONFIG_SOC_MAX32670) || \
(CONFIG_SOC_MAX32672) || (CONFIG_SOC_MAX32662) || (CONFIG_SOC_MAX32675) || \
(CONFIG_SOC_MAX32680)
(CONFIG_SOC_MAX32680) || (CONFIG_SOC_MAX32657)

#define ADI_MAX32_SPI_CTRL_MASTER_MODE MXC_F_SPI_CTRL0_MST_MODE

Expand Down
2 changes: 1 addition & 1 deletion MAX/Include/wrap_max32_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static inline void Wrap_MXC_SYS_SetClockDiv(int div)
*/
#elif defined(CONFIG_SOC_MAX32690) || (CONFIG_SOC_MAX32655) || (CONFIG_SOC_MAX32670) || \
(CONFIG_SOC_MAX32672) || (CONFIG_SOC_MAX32662) || (CONFIG_SOC_MAX32675) || \
(CONFIG_SOC_MAX32680)
(CONFIG_SOC_MAX32680) || (CONFIG_SOC_MAX32657)

#define ADI_MAX32_CLK_IPO MXC_SYS_CLOCK_IPO
#define ADI_MAX32_CLK_ERFO MXC_SYS_CLOCK_ERFO
Expand Down
2 changes: 1 addition & 1 deletion MAX/Include/wrap_max32_tmr.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ int Wrap_MXC_TMR_GetPendingInt(mxc_tmr_regs_t *tmr)
*/
#elif defined(CONFIG_SOC_MAX32690) || (CONFIG_SOC_MAX32655) || (CONFIG_SOC_MAX32670) || \
(CONFIG_SOC_MAX32672) || (CONFIG_SOC_MAX32662) || (CONFIG_SOC_MAX32675) || \
(CONFIG_SOC_MAX32680)
(CONFIG_SOC_MAX32680) || (CONFIG_SOC_MAX32657)

#if defined(CONFIG_SOC_MAX32672) || (CONFIG_SOC_MAX32675)
/* All timers are 32bits */
Expand Down
2 changes: 1 addition & 1 deletion MAX/Include/wrap_max32_trng.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static inline int Wrap_MXC_TRNG_RandomInt_NonBlocking(uint32_t *data)
*/
#elif defined(CONFIG_SOC_MAX32690) || (CONFIG_SOC_MAX32655) || (CONFIG_SOC_MAX32670) || \
(CONFIG_SOC_MAX32672) || (CONFIG_SOC_MAX32662) || (CONFIG_SOC_MAX32675) || \
(CONFIG_SOC_MAX32680)
(CONFIG_SOC_MAX32680) || (CONFIG_SOC_MAX32657)

static inline int Wrap_MXC_TRNG_RandomInt_NonBlocking(uint32_t *data)
{
Expand Down
4 changes: 2 additions & 2 deletions MAX/Include/wrap_max32_uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ static inline void Wrap_MXC_UART_DisableRxDMA(mxc_uart_regs_t *uart)
*/
#elif defined(CONFIG_SOC_MAX32690) || (CONFIG_SOC_MAX32655) || (CONFIG_SOC_MAX32670) || \
(CONFIG_SOC_MAX32672) || (CONFIG_SOC_MAX32662) || (CONFIG_SOC_MAX32675) || \
(CONFIG_SOC_MAX32680)
(CONFIG_SOC_MAX32680) || (CONFIG_SOC_MAX32657)
// status flags
#define ADI_MAX32_UART_RX_EMPTY MXC_F_UART_STATUS_RX_EM
#define ADI_MAX32_UART_TX_EMPTY MXC_F_UART_STATUS_TX_EM

#if defined(CONFIG_SOC_MAX32662)
#if defined(CONFIG_SOC_MAX32662) || (CONFIG_SOC_MAX32657)
// error flags
#define ADI_MAX32_UART_ERROR_OVERRUN MXC_F_UART_INTFL_RX_OV
#define ADI_MAX32_UART_ERROR_PARITY MXC_F_UART_INTFL_RX_PAR
Expand Down
2 changes: 1 addition & 1 deletion MAX/Include/wrap_max32_wdt.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static inline int Wrap_MXC_WDT_SelectClockSource(mxc_wdt_regs_t *wdt, uint32_t c
*/
#elif defined(CONFIG_SOC_MAX32690) || (CONFIG_SOC_MAX32655) || (CONFIG_SOC_MAX32670) || \
(CONFIG_SOC_MAX32672) || (CONFIG_SOC_MAX32662) || (CONFIG_SOC_MAX32675) || \
(CONFIG_SOC_MAX32680)
(CONFIG_SOC_MAX32680) || (CONFIG_SOC_MAX32657)

#define WRAP_MXC_F_WDT_CTRL_EN MXC_F_WDT_CTRL_EN

Expand Down
2 changes: 2 additions & 0 deletions MAX/Include/wrap_max32xxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ extern "C" {
#include <max78000.h>
#elif defined(CONFIG_SOC_MAX78002)
#include <max78002.h>
#elif defined(CONFIG_SOC_MAX32657)
#include <max32657.h>
#endif

#ifdef __cplusplus
Expand Down
12 changes: 12 additions & 0 deletions MAX/Libraries/CMSIS/Device/Maxim/MAX32520/Source/system_max32520.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ __weak int PreInit(void)
return 0;
}

/* This function is called before the Board_Init function. This weak
* implementation does nothing, but you may over-ride this function in your
* program if you want to configure the state of all pins prior to the
* application running. This is useful when using external tools (like a
* Pin Mux configuration tool) that generate code to initialize the pins.
*/
__weak void PinInit(void)
{
/* Do nothing */
}

/* This function can be implemented by the application to initialize the board */
__weak int Board_Init(void)
{
Expand Down Expand Up @@ -139,5 +150,6 @@ __weak void SystemInit(void)
MXC_GPIO1->pdpu_sel0 |= 0xFFFFFFFF;
MXC_GPIO1->pdpu_sel1 &= ~(0xFFFFFFFF);

PinInit();
Board_Init();
}
12 changes: 12 additions & 0 deletions MAX/Libraries/CMSIS/Device/Maxim/MAX32570/Source/system_max32570.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ __weak int PreInit(void)
return 0;
}

/* This function is called before the Board_Init function. This weak
* implementation does nothing, but you may over-ride this function in your
* program if you want to configure the state of all pins prior to the
* application running. This is useful when using external tools (like a
* Pin Mux configuration tool) that generate code to initialize the pins.
*/
__weak void PinInit(void)
{
/* Do nothing */
}

/* This function can be implemented by the application to initialize the board */
__weak int Board_Init(void)
{
Expand Down Expand Up @@ -138,5 +149,6 @@ __weak void SystemInit(void)
MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_GPIO0);
MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_GPIO1);

PinInit();
Board_Init();
}
12 changes: 12 additions & 0 deletions MAX/Libraries/CMSIS/Device/Maxim/MAX32572/Source/system_max32572.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ __weak int PreInit(void)
return 0;
}

/* This function is called before the Board_Init function. This weak
* implementation does nothing, but you may over-ride this function in your
* program if you want to configure the state of all pins prior to the
* application running. This is useful when using external tools (like a
* Pin Mux configuration tool) that generate code to initialize the pins.
*/
__weak void PinInit(void)
{
/* Do nothing */
}

/* This function can be implemented by the application to initialize the board */
__weak int Board_Init(void)
{
Expand Down Expand Up @@ -139,5 +150,6 @@ __weak void SystemInit(void)
MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_GPIO0);
MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_GPIO1);

PinInit();
Board_Init();
}
12 changes: 12 additions & 0 deletions MAX/Libraries/CMSIS/Device/Maxim/MAX32650/Source/system_max32650.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ __weak int PreInit(void)
return 0;
}

/* This function is called before the Board_Init function. This weak
* implementation does nothing, but you may over-ride this function in your
* program if you want to configure the state of all pins prior to the
* application running. This is useful when using external tools (like a
* Pin Mux configuration tool) that generate code to initialize the pins.
*/
__weak void PinInit(void)
{
/* Do nothing */
}

/* This function can be implemented by the application to initialize the board */
__weak int Board_Init(void)
{
Expand Down Expand Up @@ -177,6 +188,7 @@ __weak void SystemInit(void)
MXC_SYS_ClockDisable(MXC_SYS_PERIPH_CLOCK_I2S);
MXC_SYS_ClockDisable(MXC_SYS_PERIPH_CLOCK_SPIXIPR);

PinInit();
Board_Init();
}

Expand Down
12 changes: 12 additions & 0 deletions MAX/Libraries/CMSIS/Device/Maxim/MAX32655/Source/system_max32655.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ __weak int PreInit(void)
return 0;
}

/* This function is called before the Board_Init function. This weak
* implementation does nothing, but you may over-ride this function in your
* program if you want to configure the state of all pins prior to the
* application running. This is useful when using external tools (like a
* Pin Mux configuration tool) that generate code to initialize the pins.
*/
__weak void PinInit(void)
{
/* Do nothing */
}

/* This function can be implemented by the application to initialize the board */
__weak int Board_Init(void)
{
Expand Down Expand Up @@ -164,6 +175,7 @@ __weak void SystemInit(void)
MXC_SYS_SetClockDiv(MXC_SYS_CLOCK_DIV_1);
SystemCoreClockUpdate();

PinInit();
Board_Init();

PalSysInit();
Expand Down
Loading

0 comments on commit 08157ac

Please sign in to comment.