Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MAX32657 CMSIS & Include files #3

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions MAX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ set(MSDK_PERIPH_INC_DIR ${MSDK_PERIPH_DIR}/Include/${TARGET_UC})

zephyr_include_directories(
./Include
./Source/${TARGET_UC}
${MSDK_LIBRARY_DIR}/CMSIS/Include
${MSDK_CMSIS_DIR}/Include
${MSDK_PERIPH_INC_DIR}
)
Expand All @@ -49,6 +51,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
26 changes: 21 additions & 5 deletions MAX/Include/wrap_max32_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,21 @@ 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)
#if defined(CONFIG_SOC_MAX32657)
#define ADI_MAX32_SPI_CTRL_MASTER_MODE MXC_F_SPI_CTRL0_CONT_MODE
#else
#define ADI_MAX32_SPI_CTRL_MASTER_MODE MXC_F_SPI_CTRL0_MST_MODE

#endif
#define ADI_MAX32_SPI_INT_FL_RX_UN MXC_F_SPI_INTFL_RX_UN
#define ADI_MAX32_SPI_INT_FL_RX_OV MXC_F_SPI_INTFL_RX_OV
#define ADI_MAX32_SPI_INT_FL_TX_UN MXC_F_SPI_INTFL_TX_UN
#define ADI_MAX32_SPI_INT_FL_TX_OV MXC_F_SPI_INTFL_TX_OV
#if defined(CONFIG_SOC_MAX32657)
#define ADI_MAX32_SPI_INT_FL_MST_DONE MXC_F_SPI_INTFL_CONT_DONE
#else
#define ADI_MAX32_SPI_INT_FL_MST_DONE MXC_F_SPI_INTFL_MST_DONE
#endif
#define ADI_MAX32_SPI_INT_FL_ABORT MXC_F_SPI_INTFL_ABORT
#define ADI_MAX32_SPI_INT_FL_FAULT MXC_F_SPI_INTFL_FAULT
#define ADI_MAX32_SPI_INT_FL_SSD MXC_F_SPI_INTFL_SSD
Expand All @@ -96,7 +102,11 @@ static inline int Wrap_MXC_SPI_Init(mxc_spi_regs_t *spi, int masterMode, int qua
#define ADI_MAX32_SPI_INT_EN_RX_OV MXC_F_SPI_INTEN_RX_OV
#define ADI_MAX32_SPI_INT_EN_TX_UN MXC_F_SPI_INTEN_TX_UN
#define ADI_MAX32_SPI_INT_EN_TX_OV MXC_F_SPI_INTEN_TX_OV
#if defined(CONFIG_SOC_MAX32657)
#define ADI_MAX32_SPI_INT_EN_MST_DONE MXC_F_SPI_INTEN_CONT_DONE
#else
#define ADI_MAX32_SPI_INT_EN_MST_DONE MXC_F_SPI_INTEN_MST_DONE
#endif
#define ADI_MAX32_SPI_INT_EN_ABORT MXC_F_SPI_INTEN_ABORT
#define ADI_MAX32_SPI_INT_EN_FAULT MXC_F_SPI_INTEN_FAULT
#define ADI_MAX32_SPI_INT_EN_SSD MXC_F_SPI_INTEN_SSD
Expand All @@ -107,13 +117,13 @@ static inline int Wrap_MXC_SPI_Init(mxc_spi_regs_t *spi, int masterMode, int qua

#define ADI_MAX32_SPI_DMA_TX_FIFO_CLEAR MXC_F_SPI_DMA_TX_FLUSH
#define ADI_MAX32_SPI_DMA_RX_FIFO_CLEAR MXC_F_SPI_DMA_RX_FLUSH
#if defined(CONFIG_SOC_MAX32662)
#if defined(CONFIG_SOC_MAX32657) || defined(CONFIG_SOC_MAX32662)
#define ADI_MAX32_SPI_DMA_TX_DMA_EN MXC_F_SPI_DMA_TX_EN
#define ADI_MAX32_SPI_DMA_RX_DMA_EN MXC_F_SPI_DMA_RX_EN
#else
#define ADI_MAX32_SPI_DMA_TX_DMA_EN MXC_F_SPI_DMA_DMA_TX_EN
#define ADI_MAX32_SPI_DMA_RX_DMA_EN MXC_F_SPI_DMA_DMA_RX_EN
#endif /* defined(CONFIG_SOC_MAX32662) */
#endif /* defined(CONFIG_SOC_MAX32657) || defined(CONFIG_SOC_MAX32662) */

static inline int Wrap_MXC_SPI_Init(mxc_spi_regs_t *spi, int masterMode, int quadModeUsed,
int numSlaves, unsigned ssPolarity, unsigned int hz)
Expand All @@ -128,6 +138,12 @@ static inline int Wrap_MXC_SPI_Init(mxc_spi_regs_t *spi, int masterMode, int qua

#endif // part number

#if defined(CONFIG_SOC_MAX32657)
#define ADI_MAX32_SPI_CTRL0_SS_CTRL MXC_F_SPI_CTRL0_TS_CTRL
#else
#define ADI_MAX32_SPI_CTRL0_SS_CTRL MXC_F_SPI_CTRL0_SS_CTRL
#endif

#ifdef __cplusplus
}
#endif
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
9 changes: 7 additions & 2 deletions MAX/Include/wrap_max32_tmr.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ 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)
#if defined(CONFIG_SOC_MAX32672) || (CONFIG_SOC_MAX32675) || (CONFIG_SOC_MAX32657)
/* All timers are 32bits */
#define WRAP_MXC_IS_32B_TIMER(idx) (1)
#elif defined(CONFIG_SOC_MAX32662)
Expand Down Expand Up @@ -159,6 +159,10 @@ static inline int Wrap_MXC_TMR_GetClockIndex(int z_clock)

void Wrap_MXC_TMR_EnableWakeup(mxc_tmr_regs_t *tmr, wrap_mxc_tmr_cfg_t *cfg)
{
#if defined(CONFIG_SOC_MAX32657)
(void)tmr;
(void)cfg;
#else
mxc_tmr_cfg_t mxc_cfg;

mxc_cfg.pres = cfg->pres;
Expand All @@ -172,6 +176,7 @@ void Wrap_MXC_TMR_EnableWakeup(mxc_tmr_regs_t *tmr, wrap_mxc_tmr_cfg_t *cfg)
MXC_LP_EnableTimerWakeup(tmr);
// Enable Timer wake-up source
MXC_TMR_EnableWakeup(tmr, &mxc_cfg);
#endif
}

void Wrap_MXC_TMR_ClearWakeupFlags(mxc_tmr_regs_t *tmr)
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
10 changes: 7 additions & 3 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 All @@ -133,7 +133,11 @@ static inline void Wrap_MXC_UART_DisableRxDMA(mxc_uart_regs_t *uart)
#define ADI_MAX32_UART_INT_OE MXC_F_UART_INTEN_RX_OV // Overrun Error Interrupt
#define ADI_MAX32_UART_INT_PE MXC_F_UART_INTEN_RX_PAR // Parity Error Interrupt
#define ADI_MAX32_UART_INT_FE MXC_F_UART_INTEN_RX_FERR // Framing Error Interrupt
#if defined(CONFIG_SOC_MAX32657)
#define ADI_MAX32_UART_INT_TX MXC_F_UART_INTEN_TX_THD // Transmit Interrupt
#else
#define ADI_MAX32_UART_INT_TX MXC_F_UART_INTEN_TX_HE // Transmit Interrupt
#endif
#define ADI_MAX32_UART_INT_RX MXC_F_UART_INTEN_RX_THD // Receive Interrupt
#define ADI_MAX32_UART_INT_CTS MXC_F_UART_INTEN_CTS_EV // CTS Modem Interrupt
#define ADI_MAX32_UART_INT_TX_OEM MXC_F_UART_INTEN_TX_OB // TX FIFO Almost Empty Interrupt
Expand Down Expand Up @@ -215,7 +219,7 @@ static inline void Wrap_MXC_UART_DisableRxDMA(mxc_uart_regs_t *uart)

static inline unsigned int Wrap_MXC_UART_GetRegINTEN(mxc_uart_regs_t *uart)
{
#if defined(CONFIG_SOC_MAX32662)
#if defined(CONFIG_SOC_MAX32662) || (CONFIG_SOC_MAX32657)
return uart->inten;
#else
return uart->int_en;
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
Loading