From 841e8da954770c8ed946b181c40c6aa99d91e5f2 Mon Sep 17 00:00:00 2001 From: RaduSabau1 Date: Thu, 12 Sep 2024 13:39:07 +0300 Subject: [PATCH] projects: max25603 : Add MAX25603 project files Add initial header and source files alongside Makefiles for MAX25603 device project. Signed-off-by: Radu Sabau --- projects/max25603/Makefile | 5 + projects/max25603/builds.json | 7 ++ projects/max25603/src.mk | 41 ++++++++ projects/max25603/src/common/common_data.c | 97 +++++++++++++++++++ projects/max25603/src/common/common_data.h | 48 +++++++++ .../src/examples/basic/basic_example.c | 77 +++++++++++++++ .../src/examples/basic/basic_example.h | 38 ++++++++ .../max25603/src/examples/examples_src.mk | 2 + projects/max25603/src/platform/maxim/main.c | 55 +++++++++++ .../max25603/src/platform/maxim/parameters.c | 45 +++++++++ .../max25603/src/platform/maxim/parameters.h | 87 +++++++++++++++++ .../src/platform/maxim/platform_src.mk | 16 +++ .../max25603/src/platform/platform_includes.h | 40 ++++++++ 13 files changed, 558 insertions(+) create mode 100644 projects/max25603/Makefile create mode 100644 projects/max25603/builds.json create mode 100644 projects/max25603/src.mk create mode 100644 projects/max25603/src/common/common_data.c create mode 100644 projects/max25603/src/common/common_data.h create mode 100644 projects/max25603/src/examples/basic/basic_example.c create mode 100644 projects/max25603/src/examples/basic/basic_example.h create mode 100644 projects/max25603/src/examples/examples_src.mk create mode 100644 projects/max25603/src/platform/maxim/main.c create mode 100644 projects/max25603/src/platform/maxim/parameters.c create mode 100644 projects/max25603/src/platform/maxim/parameters.h create mode 100644 projects/max25603/src/platform/maxim/platform_src.mk create mode 100644 projects/max25603/src/platform/platform_includes.h diff --git a/projects/max25603/Makefile b/projects/max25603/Makefile new file mode 100644 index 00000000000..76bac6d3ad5 --- /dev/null +++ b/projects/max25603/Makefile @@ -0,0 +1,5 @@ +include ../../tools/scripts/generic_variables.mk + +include src.mk + +include ../../tools/scripts/generic.mk diff --git a/projects/max25603/builds.json b/projects/max25603/builds.json new file mode 100644 index 00000000000..a0536e4fce8 --- /dev/null +++ b/projects/max25603/builds.json @@ -0,0 +1,7 @@ +{ + "maxim": { + "basic_example_max32690": { + "flags" : "TARGET=max32690" + } + } +} diff --git a/projects/max25603/src.mk b/projects/max25603/src.mk new file mode 100644 index 00000000000..aa5d5c40247 --- /dev/null +++ b/projects/max25603/src.mk @@ -0,0 +1,41 @@ +include $(PROJECT)/src/platform/$(PLATFORM)/platform_src.mk +include $(PROJECT)/src/examples/examples_src.mk + +SRCS += $(PROJECT)/src/platform/$(PLATFORM)/main.c + +INCS += $(PROJECT)/src/common/common_data.h +SRCS += $(PROJECT)/src/common/common_data.c + +INCS += $(PROJECT)/src/platform/platform_includes.h + +INCS += $(PROJECT)/src/platform/$(PLATFORM)/parameters.h +SRCS += $(PROJECT)/src/platform/$(PLATFORM)/parameters.c + +INCS += $(INCLUDE)/no_os_delay.h \ + $(INCLUDE)/no_os_error.h \ + $(INCLUDE)/no_os_gpio.h \ + $(INCLUDE)/no_os_print_log.h \ + $(INCLUDE)/no_os_alloc.h \ + $(INCLUDE)/no_os_irq.h \ + $(INCLUDE)/no_os_list.h \ + $(INCLUDE)/no_os_dma.h \ + $(INCLUDE)/no_os_uart.h \ + $(INCLUDE)/no_os_lf256fifo.h \ + $(INCLUDE)/no_os_util.h \ + $(INCLUDE)/no_os_units.h \ + $(INCLUDE)/no_os_pwm.h \ + $(INCLUDE)/no_os_mutex.h + +SRCS += $(DRIVERS)/api/no_os_gpio.c \ + $(NO-OS)/util/no_os_lf256fifo.c \ + $(DRIVERS)/api/no_os_irq.c \ + $(DRIVERS)/api/no_os_uart.c \ + $(DRIVERS)/api/no_os_dma.c \ + $(DRIVERS)/api/no_os_pwm.c \ + $(NO-OS)/util/no_os_list.c \ + $(NO-OS)/util/no_os_util.c \ + $(NO-OS)/util/no_os_alloc.c \ + $(NO-OS)/util/no_os_mutex.c + +INCS += $(DRIVERS)/led/max25603/max25603.h +SRCS += $(DRIVERS)/led/max25603/max25603.c diff --git a/projects/max25603/src/common/common_data.c b/projects/max25603/src/common/common_data.c new file mode 100644 index 00000000000..e1f184d7039 --- /dev/null +++ b/projects/max25603/src/common/common_data.c @@ -0,0 +1,97 @@ +/***************************************************************************//** + * @file common_data.c + * @brief Common data used by the MAX25603 project. + * @author Radu Sabau (radu.sabau@analog.com) +******************************************************************************** + * Copyright 2024(c) Analog Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*******************************************************************************/ +#include "common_data.h" + + +struct no_os_uart_init_param max25603_uart_ip = { + .device_id = UART_DEVICE_ID, + .baud_rate = UART_BAUDRATE, + .size = NO_OS_UART_CS_8, + .platform_ops = UART_OPS, + .parity = NO_OS_UART_PAR_NO, + .stop = NO_OS_UART_STOP_1_BIT, + .extra = UART_EXTRA, +}; + +struct no_os_gpio_init_param max25603_shunt_ip = { + .port = GPIO_SHUNT_PORT_NUM, + .pull = NO_OS_PULL_NONE, + .number = GPIO_SHUNT_PIN_NUM, + .platform_ops = GPIO_OPS, + .extra = GPIO_EXTRA, +}; + +struct no_os_pwm_init_param max25603_en1_ip = { + .id = PWM_EN1_ID, + .period_ns = PWM_EN1_PERIOD_NS, + .duty_cycle_ns = PWM_EN1_DUTY_NS, + .polarity = NO_OS_PWM_POLARITY_HIGH, + .platform_ops = PWM_OPS, + .extra = PWM_EXTRA, +}; + +struct no_os_pwm_init_param max25603_en2_ip = { + .id = PWM_EN2_ID, + .period_ns = PWM_EN2_PERIOD_NS, + .duty_cycle_ns = PWM_EN2_DUTY_NS, + .polarity = NO_OS_PWM_POLARITY_HIGH, + .platform_ops = PWM_OPS, + .extra = PWM_EXTRA, +}; + +struct no_os_pwm_init_param max25603_hb_ip = { + .id = PWM_HB_ID, + .period_ns = PWM_HB_PERIOD_NS, + .duty_cycle_ns = PWM_HB_DUTY_NS, + .polarity = NO_OS_PWM_POLARITY_HIGH, + .platform_ops = PWM_OPS, + .extra = PWM_EXTRA, +}; + +struct no_os_pwm_init_param max25603_lb_ip = { + .id = PWM_LB_ID, + .period_ns = PWM_LB_PERIOD_NS, + .duty_cycle_ns = PWM_LB_DUTY_NS, + .polarity = NO_OS_PWM_POLARITY_HIGH, + .platform_ops = PWM_OPS, + .extra = PWM_EXTRA, +}; + +struct max25603_init_param max25603_ip = { + .en1_param = &max25603_en1_ip, + .en2_param = &max25603_en2_ip, + .flt_param = NULL, + .hb_param = &max25603_hb_ip, + .lb_param = &max25603_lb_ip, + .shunt_param = &max25603_shunt_ip, +}; diff --git a/projects/max25603/src/common/common_data.h b/projects/max25603/src/common/common_data.h new file mode 100644 index 00000000000..d020186b544 --- /dev/null +++ b/projects/max25603/src/common/common_data.h @@ -0,0 +1,48 @@ +/***************************************************************************//** + * @file common_data.h + * @brief Common data used by the MAX25603 project. + * @author Radu Sabau (radu.sabau@analog.com) +******************************************************************************** + * Copyright 2024(c) Analog Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*******************************************************************************/ +#ifndef __COMMON_DATA_H__ +#define __COMMON_DATA_H__ + +#include "platform_includes.h" +#include "max25603.h" + +extern struct no_os_uart_init_param max25603_uart_ip; +extern struct no_os_gpio_init_param max25603_shunt_ip; +extern struct no_os_gpio_init_param max25603_flt_ip; +extern struct no_os_pwm_init_param max25603_en1_ip; +extern struct no_os_pwm_init_param max25603_en2_ip; +extern struct no_os_pwm_init_param max25603_hb_ip; +extern struct no_os_pwm_init_param max25603_lb_ip; +extern struct max25603_init_param max25603_ip; + +#endif /* __COMMON_DATA_H__ */ diff --git a/projects/max25603/src/examples/basic/basic_example.c b/projects/max25603/src/examples/basic/basic_example.c new file mode 100644 index 00000000000..7cd6dc7e4cc --- /dev/null +++ b/projects/max25603/src/examples/basic/basic_example.c @@ -0,0 +1,77 @@ +/***************************************************************************//** + * @file basic_example.c + * @brief Source file for basic example. + * @author Radu Sabau (radu.sabau@analog.com) +******************************************************************************** + * Copyright 2024(c) Analog Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*******************************************************************************/ +#include "basic_example.h" +#include "common_data.h" +#include "max25603.h" +#include "no_os_delay.h" +#include "no_os_print_log.h" +#include "no_os_irq.h" + +int basic_example_main() +{ + struct max25603_desc *max25603_desc; + int ret; + + ret = max25603_init(&max25603_desc, &max25603_ip); + if (ret) + goto exit; + + ret = max25603_sel_comp(max25603_desc, MAX25603_COMP1); + if (ret) + goto remove_max25603; + + ret = max25603_set_enable(max25603_desc, MAX25603_EN2, 100000, 100); + if (ret) + goto remove_max25603; + + ret = max25603_set_beam(max25603_desc, MAX25603_LOW_BEAM, 50, 50); + if (ret) + goto remove_max25603; + + no_os_mdelay(5000); + + ret = max25603_set_beam(max25603_desc, MAX25603_DISABLE_BEAM, 0, 0); + if (ret) + goto remove_max25603; + + ret = max25603_set_enable(max25603_desc, MAX25603_DISABLE_EN, 0, 0); + if (ret) + goto remove_max25603; + +remove_max25603: + max25603_remove(max25603_desc); +exit: + if (ret) + pr_info("Error!\n"); + return ret; +} diff --git a/projects/max25603/src/examples/basic/basic_example.h b/projects/max25603/src/examples/basic/basic_example.h new file mode 100644 index 00000000000..b023ef3a02c --- /dev/null +++ b/projects/max25603/src/examples/basic/basic_example.h @@ -0,0 +1,38 @@ +/***************************************************************************//** + * @file basic_example.h + * @brief Header file for basic example. + * @author Radu Sabau (radu.sabau@analog.com) +******************************************************************************** + * Copyright 2024(c) Analog Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*******************************************************************************/ +#ifndef __BASIC_EXAMPLE_H__ +#define __BASIC_EXAMPLE_H__ + +int basic_example_main(); + +#endif /* __BASIC_EXAMPLE_H__ */ diff --git a/projects/max25603/src/examples/examples_src.mk b/projects/max25603/src/examples/examples_src.mk new file mode 100644 index 00000000000..b584d55fd4b --- /dev/null +++ b/projects/max25603/src/examples/examples_src.mk @@ -0,0 +1,2 @@ +SRCS += $(PROJECT)/src/examples/basic/basic_example.c +INCS += $(PROJECT)/src/examples/basic/basic_example.h diff --git a/projects/max25603/src/platform/maxim/main.c b/projects/max25603/src/platform/maxim/main.c new file mode 100644 index 00000000000..987b1a0c2c8 --- /dev/null +++ b/projects/max25603/src/platform/maxim/main.c @@ -0,0 +1,55 @@ +/***************************************************************************//** + * @file main.c + * @brief Main file for Maxim platform of MAX25603 project. + * @author Radu Sabau (radu.sabau@analog.com) +******************************************************************************** + * Copyright 2024(c) Analog Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*******************************************************************************/ +#include "platform_includes.h" +#include "common_data.h" +#include "no_os_error.h" +#include "basic_example.h" + +int main() +{ + int ret = -EINVAL; + + struct no_os_uart_desc *uart_desc; + + ret = no_os_uart_init(&uart_desc, &max25603_uart_ip); + if (ret) + return ret; + + no_os_uart_stdio(uart_desc); + + ret = basic_example_main(); + + no_os_uart_remove(uart_desc); + + return ret; +} diff --git a/projects/max25603/src/platform/maxim/parameters.c b/projects/max25603/src/platform/maxim/parameters.c new file mode 100644 index 00000000000..735bc3e3a90 --- /dev/null +++ b/projects/max25603/src/platform/maxim/parameters.c @@ -0,0 +1,45 @@ +/***************************************************************************//** + * @file parameters.c + * @brief Definition of Maxim platform data used by MAX25603 project. + * @author Radu Sabau (radu.sabau@analog.com) +******************************************************************************** + * Copyright 2024(c) Analog Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*******************************************************************************/ +#include "parameters.h" + +struct max_uart_init_param max25603_uart_extra = { + .flow = UART_FLOW_DIS, +}; + +struct max_gpio_init_param max25603_gpio_extra = { + .vssel = MXC_GPIO_VSSEL_VDDIOH, +}; + +struct max_pwm_init_param max25603_pwm_extra = { + .vssel = MXC_GPIO_VSSEL_VDDIOH, +}; diff --git a/projects/max25603/src/platform/maxim/parameters.h b/projects/max25603/src/platform/maxim/parameters.h new file mode 100644 index 00000000000..f11486591c3 --- /dev/null +++ b/projects/max25603/src/platform/maxim/parameters.h @@ -0,0 +1,87 @@ +/***************************************************************************//** + * @file parameters.h + * @brief Definition of Maxim platform data used by MAX25603 project. + * @author Radu Sabau (radu.sabau@analog.com) +******************************************************************************** + * Copyright 2024(c) Analog Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*******************************************************************************/ +#ifndef __PARAMETERS_H__ +#define __PARAMETERS_H__ + +#include "maxim_pwm.h" +#include "maxim_gpio.h" +#include "maxim_uart.h" +#include "maxim_uart_stdio.h" + + +#if (TARGET_NUM == 32690) +#define UART_IRQ_ID UART0_IRQn +#define UART_DEVICE_ID 0 +#define UART_BAUDRATE 57600 +#endif + +#define UART_EXTRA &max25603_uart_extra +#define UART_OPS &max_uart_ops + +#if (TARGET_NUM == 32690) +#define PWM_EN1_ID 3 +#define PWM_EN1_PERIOD_NS 200000000 +#define PWM_EN1_DUTY_NS 100000000 + +#define PWM_EN2_ID 2 +#define PWM_EN2_PERIOD_NS 200000000 +#define PWM_EN2_DUTY_NS 100000000 + +#define PWM_LB_ID 1 +#define PWM_LB_PERIOD_NS 200000000 +#define PWM_LB_DUTY_NS 100000000 + +#define PWM_HB_ID 0 +#define PWM_HB_PERIOD_NS 200000000 +#define PWM_HB_DUTY_NS 100000000 +#endif + +#define PWM_EXTRA &max25603_pwm_extra +#define PWM_OPS &max_pwm_ops + +#if (TARGET_NUM == 32690) +#define GPIO_SHUNT_PORT_NUM 1 +#define GPIO_SHUNT_PIN_NUM 6 + +#define GPIO_FLT_PORT_NUM 2 +#define GPIO_FLT_PIN_NUM 21 +#endif + +#define GPIO_OPS &max_gpio_ops +#define GPIO_EXTRA &max25603_gpio_extra + +extern struct max_uart_init_param max25603_uart_extra; +extern struct max_pwm_init_param max25603_pwm_extra; +extern struct max_gpio_init_param max25603_gpio_extra; + +#endif /* __PARAMETERS_H__ */ diff --git a/projects/max25603/src/platform/maxim/platform_src.mk b/projects/max25603/src/platform/maxim/platform_src.mk new file mode 100644 index 00000000000..349f44f2b4e --- /dev/null +++ b/projects/max25603/src/platform/maxim/platform_src.mk @@ -0,0 +1,16 @@ +INCS += $(PLATFORM_DRIVERS)/maxim_gpio.h \ + $(PLATFORM_DRIVERS)/maxim_spi.h \ + $(PLATFORM_DRIVERS)/../common/maxim_dma.h \ + $(PLATFORM_DRIVERS)/maxim_irq.h \ + $(PLATFORM_DRIVERS)/maxim_pwm.h \ + $(PLATFORM_DRIVERS)/maxim_uart.h \ + $(PLATFORM_DRIVERS)/maxim_uart_stdio.h \ + $(PLATFORM_DRIVERS)/maxim_gpio_irq.h + +SRCS += $(PLATFORM_DRIVERS)/maxim_gpio.c \ + $(PLATFORM_DRIVERS)/maxim_irq.c \ + $(PLATFORM_DRIVERS)/maxim_delay.c \ + $(PLATFORM_DRIVERS)/maxim_pwm.c \ + $(PLATFORM_DRIVERS)/maxim_uart.c \ + $(PLATFORM_DRIVERS)/maxim_uart_stdio.c \ + $(PLATFORM_DRIVERS)/maxim_gpio_irq.c diff --git a/projects/max25603/src/platform/platform_includes.h b/projects/max25603/src/platform/platform_includes.h new file mode 100644 index 00000000000..8bbdaa87ffd --- /dev/null +++ b/projects/max25603/src/platform/platform_includes.h @@ -0,0 +1,40 @@ +/***************************************************************************//** + * @file platform_includes.h + * @brief Includes for used platforms used by MAX25603 project. + * @author Radu Sabau (radu.sabau@analog.com) +******************************************************************************** + * Copyright 2024(c) Analog Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*******************************************************************************/ +#ifndef __PLATFORM_INCLUDES_H__ +#define __PLATFORM_INCLUDES_H__ + +#ifdef MAXIM_PLATFORM +#include "maxim/parameters.h" +#endif + +#endif /* __PLATFORM_INCLUDES_H__ */