Skip to content

Commit

Permalink
Merge branch 'main' into feat/disable_clock
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Carter authored Nov 30, 2023
2 parents 424351a + 06d693e commit 81dea56
Show file tree
Hide file tree
Showing 64 changed files with 4,072 additions and 561 deletions.
2 changes: 1 addition & 1 deletion Examples/MAX32655/Bluetooth/Bootloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ MXC_OPTIMIZE_CFLAGS ?= -Og

# Set compiler flags
PROJ_CFLAGS += -Wall # Enable warnings
PROJ_CFLAGS += -DMXC_ASSERT_ENABLE
# PROJ_CFLAGS += -DMXC_ASSERT_ENABLE

# Set hardware floating point acceleration.
# Options are:
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32662/SCPA_OTP_Dump/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ MXC_OPTIMIZE_CFLAGS ?= -Og

# Set compiler flags
PROJ_CFLAGS += -Wall # Enable warnings
PROJ_CFLAGS += -DMXC_ASSERT_ENABLE
# PROJ_CFLAGS += -DMXC_ASSERT_ENABLE

# Set hardware floating point acceleration.
# Options are:
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32665/Bluetooth/Bootloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ MXC_OPTIMIZE_CFLAGS ?= -Og

# Set compiler flags
PROJ_CFLAGS += -Wall # Enable warnings
PROJ_CFLAGS += -DMXC_ASSERT_ENABLE
# PROJ_CFLAGS += -DMXC_ASSERT_ENABLE

# Set hardware floating point acceleration.
# Options are:
Expand Down
41 changes: 15 additions & 26 deletions Examples/MAX32672/UART/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,9 @@

/***** Globals *****/
volatile int READ_FLAG;
volatile int DMA_FLAG;

/***** Functions *****/
#ifdef DMA
void DMA_Handler(void)
{
MXC_DMA_Handler();
DMA_FLAG = 0;
}
#else // DMA
#ifndef DMA
void Reading_UART_Handler(void)
{
MXC_UART_AsyncHandler(READING_UART);
Expand Down Expand Up @@ -121,11 +114,7 @@ int main(void)
}
memset(RxData, 0x0, BUFF_SIZE);

#ifdef DMA
MXC_DMA_ReleaseChannel(0);
MXC_NVIC_SetVector(DMA0_IRQn, DMA_Handler);
NVIC_EnableIRQ(DMA0_IRQn);
#else // DMA
#ifndef DMA
NVIC_ClearPendingIRQ(MXC_UART_GET_IRQ(READING_UART_IDX));
NVIC_DisableIRQ(MXC_UART_GET_IRQ(READING_UART_IDX));
MXC_NVIC_SetVector(MXC_UART_GET_IRQ(READING_UART_IDX), Reading_UART_Handler);
Expand All @@ -150,6 +139,12 @@ int main(void)
}
printf("-->Writing UART Initialized\n\n");

#ifdef DMA
// Automatically set up DMA handlers/ISRs
MXC_UART_SetAutoDMAHandlers(READING_UART, true);
MXC_UART_SetAutoDMAHandlers(WRITING_UART, true);
#endif

// Set Parameters for UART transaction requests
mxc_uart_req_t read_req;
read_req.uart = READING_UART;
Expand All @@ -168,16 +163,16 @@ int main(void)
printf("-->Starting transaction\n");

// Initiate Reading UART transaction
READ_FLAG = 1;
MXC_UART_ClearRXFIFO(READING_UART); // Clear any previously pending data
#ifdef DMA
DMA_FLAG = 1;
error = MXC_UART_TransactionDMA(&read_req);
#else // DMA
READ_FLAG = 1;
error = MXC_UART_TransactionAsync(&read_req);
#endif // DMA

if (error != E_NO_ERROR) {
printf("-->Error starting async read: %d\n", error);
printf("-->Error starting read: %d\n", error);
printf("-->Example Failed\n");
return error;
}
Expand All @@ -190,21 +185,15 @@ int main(void)
return error;
}

#ifdef DMA
// Wait for Reading DMA transaction to complete
while (DMA_FLAG) {}
#else // DMA

// Wait for Async Read transaction to complete
// Wait for read transaction to complete
while (READ_FLAG) {}

printf("-->Transaction complete\n\n");

if (READ_FLAG != E_NO_ERROR) {
printf("-->Error with UART_ReadAsync callback; %d\n", READ_FLAG);
printf("-->Error from UART read callback; %d\n", READ_FLAG);
fail++;
}
#endif // DMA

printf("-->Transaction complete\n\n");

// Verify data received matches data transmitted
if ((error = memcmp(RxData, TxData, BUFF_SIZE)) != 0) {
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32690/Bluetooth/Bootloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ MXC_OPTIMIZE_CFLAGS ?= -Og

# Set compiler flags
PROJ_CFLAGS += -Wall # Enable warnings
PROJ_CFLAGS += -DMXC_ASSERT_ENABLE
# # PROJ_CFLAGS += -DMXC_ASSERT_ENABLE

# Set hardware floating point acceleration.
# Options are:
Expand Down
72 changes: 28 additions & 44 deletions Examples/MAX78000/UART/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,29 +75,22 @@

/***** Globals *****/
volatile int READ_FLAG;
volatile int DMA_FLAG;

#if defined(BOARD_EVKIT_V1)
#define READING_UART 1
#define WRITING_UART 2
#define READING_UART MXC_UART1
#define WRITING_UART MXC_UART2
#elif defined(BOARD_FTHR_REVA)
#define READING_UART 2
#define WRITING_UART 3
#define READING_UART MXC_UART2
#define WRITING_UART MXC_UART3
#else
#warning "This example has been written for the MAX78000 Ev Kit or FTHR board."
#endif

/***** Functions *****/
#ifdef DMA
void DMA_Handler(void)
#ifndef DMA
void Reading_UART_Handler(void)
{
MXC_DMA_Handler();
DMA_FLAG = 0;
}
#else
void UART_Handler(void)
{
MXC_UART_AsyncHandler(MXC_UART_GET_UART(READING_UART));
MXC_UART_AsyncHandler(READING_UART);
}
#endif

Expand Down Expand Up @@ -127,62 +120,58 @@ int main(void)

memset(RxData, 0x0, BUFF_SIZE);

#ifdef DMA
MXC_DMA_Init();
MXC_DMA_ReleaseChannel(0);
MXC_NVIC_SetVector(DMA0_IRQn, DMA_Handler);
NVIC_EnableIRQ(DMA0_IRQn);
#else
NVIC_ClearPendingIRQ(MXC_UART_GET_IRQ(READING_UART));
NVIC_DisableIRQ(MXC_UART_GET_IRQ(READING_UART));
MXC_NVIC_SetVector(MXC_UART_GET_IRQ(READING_UART), UART_Handler);
NVIC_EnableIRQ(MXC_UART_GET_IRQ(READING_UART));
#ifndef DMA
NVIC_ClearPendingIRQ(MXC_UART_GET_IRQ(READING_UART_IDX));
NVIC_DisableIRQ(MXC_UART_GET_IRQ(READING_UART_IDX));
MXC_NVIC_SetVector(MXC_UART_GET_IRQ(READING_UART_IDX), Reading_UART_Handler);
NVIC_EnableIRQ(MXC_UART_GET_IRQ(READING_UART_IDX));
#endif

// Initialize the UART
if ((error = MXC_UART_Init(MXC_UART_GET_UART(READING_UART), UART_BAUD, MXC_UART_APB_CLK)) !=
E_NO_ERROR) {
if ((error = MXC_UART_Init(READING_UART, UART_BAUD, MXC_UART_APB_CLK)) != E_NO_ERROR) {
printf("-->Error initializing UART: %d\n", error);
printf("-->Example Failed\n");
return error;
}

if ((error = MXC_UART_Init(MXC_UART_GET_UART(WRITING_UART), UART_BAUD, MXC_UART_APB_CLK)) !=
E_NO_ERROR) {
if ((error = MXC_UART_Init(WRITING_UART, UART_BAUD, MXC_UART_APB_CLK)) != E_NO_ERROR) {
printf("-->Error initializing UART: %d\n", error);
printf("-->Example Failed\n");
return error;
}

printf("-->UART Initialized\n\n");

#ifdef DMA
// Automatically set up DMA handlers/ISRs
MXC_UART_SetAutoDMAHandlers(READING_UART, true);
MXC_UART_SetAutoDMAHandlers(WRITING_UART, true);
#endif

mxc_uart_req_t read_req;
read_req.uart = MXC_UART_GET_UART(READING_UART);
read_req.uart = READING_UART;
read_req.rxData = RxData;
read_req.rxLen = BUFF_SIZE;
read_req.txLen = 0;
read_req.callback = readCallback;

mxc_uart_req_t write_req;
write_req.uart = MXC_UART_GET_UART(WRITING_UART);
write_req.uart = WRITING_UART;
write_req.txData = TxData;
write_req.txLen = BUFF_SIZE;
write_req.rxLen = 0;
write_req.callback = NULL;

READ_FLAG = 1;
DMA_FLAG = 1;

MXC_UART_ClearRXFIFO(MXC_UART_GET_UART(READING_UART));

MXC_UART_ClearRXFIFO(READING_UART); // Clear any previously pending data
#ifdef DMA
error = MXC_UART_TransactionDMA(&read_req);
#else
error = MXC_UART_TransactionAsync(&read_req);
#endif

if (error != E_NO_ERROR) {
printf("-->Error starting async read: %d\n", error);
printf("-->Error starting read: %d\n", error);
printf("-->Example Failed\n");
return error;
}
Expand All @@ -195,21 +184,16 @@ int main(void)
return error;
}

#ifdef DMA

while (DMA_FLAG) {}

#else

// Wait for read transaction to complete
while (READ_FLAG) {}

printf("-->Transaction complete\n\n");

if (READ_FLAG != E_NO_ERROR) {
printf("-->Error with UART_ReadAsync callback; %d\n", READ_FLAG);
printf("-->Error from UART read callback; %d\n", READ_FLAG);
fail++;
}

#endif

if ((error = memcmp(RxData, TxData, BUFF_SIZE)) != 0) {
printf("-->Error verifying Data: %d\n", error);
fail++;
Expand Down
34 changes: 11 additions & 23 deletions Examples/MAX78002/UART/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,9 @@

/***** Globals *****/
volatile int READ_FLAG;
volatile int DMA_FLAG;

/***** Functions *****/
#ifdef DMA
void DMA_Handler(void)
{
MXC_DMA_Handler();
DMA_FLAG = 0;
}
#else
#ifndef DMA
void UART1_Handler(void)
{
MXC_UART_AsyncHandler(MXC_UART1);
Expand Down Expand Up @@ -117,11 +110,7 @@ int main(void)

memset(RxData, 0x0, BUFF_SIZE);

#ifdef DMA
MXC_DMA_ReleaseChannel(0);
MXC_NVIC_SetVector(DMA0_IRQn, DMA_Handler);
NVIC_EnableIRQ(DMA0_IRQn);
#else
#ifndef DMA
NVIC_ClearPendingIRQ(UART1_IRQn);
NVIC_DisableIRQ(UART1_IRQn);
MXC_NVIC_SetVector(UART1_IRQn, UART1_Handler);
Expand All @@ -143,6 +132,12 @@ int main(void)

printf("-->UART Initialized\n\n");

#ifdef DMA
// Automatically set up DMA handlers/ISRs
MXC_UART_SetAutoDMAHandlers(READING_UART, true);
MXC_UART_SetAutoDMAHandlers(WRITING_UART, true);
#endif

mxc_uart_req_t read_req;
read_req.uart = MXC_UART1;
read_req.rxData = RxData;
Expand All @@ -160,8 +155,7 @@ int main(void)
write_req.callback = NULL;

READ_FLAG = 1;
DMA_FLAG = 1;

MXC_UART_ClearRXFIFO(MXC_UART1); // Clear any previously pending data
#ifdef DMA
error = MXC_UART_TransactionDMA(&read_req);
#else
Expand All @@ -182,20 +176,14 @@ int main(void)
return error;
}

#ifdef DMA

while (DMA_FLAG) {}

#else

while (READ_FLAG) {}

if (READ_FLAG != E_NO_ERROR) {
printf("-->Error with UART_ReadAsync callback; %d\n", READ_FLAG);
printf("-->Error from UART read callback; %d\n", READ_FLAG);
fail++;
}

#endif
printf("-->Transaction complete\n\n");

if ((error = memcmp(RxData, TxData, BUFF_SIZE)) != 0) {
printf("-->Error verifying Data: %d\n", error);
Expand Down
2 changes: 1 addition & 1 deletion Libraries/CMSIS/Device/Maxim/MAX32650/Include/max32650.svd
Original file line number Diff line number Diff line change
Expand Up @@ -6091,7 +6091,7 @@
<field>
<name>presence_detect</name>
<description>Presence Pulse Detected.</description>
<bitRange>[5:5]</bitRange>
<bitRange>[7:7]</bitRange>
<access>read-only</access>
</field>
</fields>
Expand Down
2 changes: 1 addition & 1 deletion Libraries/CMSIS/Device/Maxim/MAX32650/Include/owm_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ typedef struct {
#define MXC_F_OWM_CTRL_STAT_OD_SPEC_MODE_POS 4 /**< CTRL_STAT_OD_SPEC_MODE Position */
#define MXC_F_OWM_CTRL_STAT_OD_SPEC_MODE ((uint32_t)(0x1UL << MXC_F_OWM_CTRL_STAT_OD_SPEC_MODE_POS)) /**< CTRL_STAT_OD_SPEC_MODE Mask */

#define MXC_F_OWM_CTRL_STAT_PRESENCE_DETECT_POS 5 /**< CTRL_STAT_PRESENCE_DETECT Position */
#define MXC_F_OWM_CTRL_STAT_PRESENCE_DETECT_POS 7 /**< CTRL_STAT_PRESENCE_DETECT Position */
#define MXC_F_OWM_CTRL_STAT_PRESENCE_DETECT ((uint32_t)(0x1UL << MXC_F_OWM_CTRL_STAT_PRESENCE_DETECT_POS)) /**< CTRL_STAT_PRESENCE_DETECT Mask */

/**@} end of group OWM_CTRL_STAT_Register */
Expand Down
2 changes: 1 addition & 1 deletion Libraries/CMSIS/Device/Maxim/MAX32655/Include/max32655.svd
Original file line number Diff line number Diff line change
Expand Up @@ -7216,7 +7216,7 @@
<field>
<name>presence_detect</name>
<description>Presence Pulse Detected.</description>
<bitRange>[5:5]</bitRange>
<bitRange>[7:7]</bitRange>
<access>read-only</access>
</field>
</fields>
Expand Down
2 changes: 1 addition & 1 deletion Libraries/CMSIS/Device/Maxim/MAX32655/Include/owm_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ typedef struct {
#define MXC_F_OWM_CTRL_STAT_OD_SPEC_MODE_POS 4 /**< CTRL_STAT_OD_SPEC_MODE Position */
#define MXC_F_OWM_CTRL_STAT_OD_SPEC_MODE ((uint32_t)(0x1UL << MXC_F_OWM_CTRL_STAT_OD_SPEC_MODE_POS)) /**< CTRL_STAT_OD_SPEC_MODE Mask */

#define MXC_F_OWM_CTRL_STAT_PRESENCE_DETECT_POS 5 /**< CTRL_STAT_PRESENCE_DETECT Position */
#define MXC_F_OWM_CTRL_STAT_PRESENCE_DETECT_POS 7 /**< CTRL_STAT_PRESENCE_DETECT Position */
#define MXC_F_OWM_CTRL_STAT_PRESENCE_DETECT ((uint32_t)(0x1UL << MXC_F_OWM_CTRL_STAT_PRESENCE_DETECT_POS)) /**< CTRL_STAT_PRESENCE_DETECT Mask */

/**@} end of group OWM_CTRL_STAT_Register */
Expand Down
4 changes: 4 additions & 0 deletions Libraries/CMSIS/Device/Maxim/MAX32665/Include/max32665.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,10 @@ typedef enum {
((i) == 7) ? DMA15_IRQn : \
0))

#define MXC_DMA_CH_GET_IRQ(i) \
(((i) > (MXC_DMA_CH_OFFSET - 1)) ? MXC_DMA1_CH_GET_IRQ(i % MXC_DMA_CH_OFFSET) : \
MXC_DMA0_CH_GET_IRQ(i))

/* Create alias for MXC_DMA0 for backwards compatibility with code that was
written for parts that only had one DMA instance. */
#define MXC_DMA MXC_DMA0
Expand Down
Loading

0 comments on commit 81dea56

Please sign in to comment.