arch/arm/src/imxrt: added support for FlexPWM driver

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
Michal Lenc
2021-06-26 11:49:38 +02:00
committed by Xiang Xiao
parent e401aa17f6
commit addfe182ae
5 changed files with 1391 additions and 0 deletions
+245
View File
@@ -170,6 +170,11 @@ config IMXRT_FLEXCAN
default n
select ARCH_HAVE_NETDEV_STATISTICS
config IMXRT_FLEXPWM
bool
default n
select ARCH_HAVE_PWM_MULTICHAN
config IMXRT_LPI2C
bool
default n
@@ -547,6 +552,246 @@ config FLEXCAN3_DATA_SAMPLEP
endmenu # IMXRT_FLEXCAN3
menu "FLEXPWM Peripherals"
config IMXRT_FLEXPWM1
bool "FLEXPWM1"
default n
select IMXRT_FLEXPWM
config IMXRT_FLEXPWM2
bool "FLEXPWM2"
default n
select IMXRT_FLEXPWM
if ARCH_FAMILY_IMXRT105x || ARCH_FAMILY_IMXRT106x
config IMXRT_FLEXPWM3
bool "FLEXPWM3"
default n
select IMXRT_FLEXPWM
config IMXRT_FLEXPWM4
bool "FLEXPWM4"
default n
select IMXRT_FLEXPWM
endif # ARCH_FAMILY_IMXRT105x || ARCH_FAMILY_IMXRT106x
endmenu # FLEXPWM Peripherals
menu "FLEXPWM1 Configuration"
depends on IMXRT_FLEXPWM1
config IMXRT_FLEXPWM1_MOD1
bool "FLEXPWM1 Module 1"
default n
if IMXRT_FLEXPWM1_MOD1
config IMXRT_FLEXPWM1_MOD1_COMP
bool "Use complementary output"
default n
endif
config IMXRT_FLEXPWM1_MOD2
bool "FLEXPWM1 Module 2"
default n
if IMXRT_FLEXPWM1_MOD2
config IMXRT_FLEXPWM1_MOD2_COMP
bool "Use complementary output"
default n
endif
config IMXRT_FLEXPWM1_MOD3
bool "FLEXPWM1 Module 3"
default n
if IMXRT_FLEXPWM1_MOD3
config IMXRT_FLEXPWM1_MOD3_COMP
bool "Use complementary output"
default n
endif
config IMXRT_FLEXPWM1_MOD4
bool "FLEXPWM1 Module 4"
default n
if IMXRT_FLEXPWM1_MOD4
config IMXRT_FLEXPWM1_MOD4_COMP
bool "Use complementary output"
default n
endif
endmenu # IMXRT_FLEXPWM1
menu "FLEXPWM2 Configuration"
depends on IMXRT_FLEXPWM2
config IMXRT_FLEXPWM2_MOD1
bool "FLEXPWM2 Module 1"
default n
if IMXRT_FLEXPWM2_MOD1
config IMXRT_FLEXPWM2_MOD1_COMP
bool "Use complementary output"
default n
endif
config IMXRT_FLEXPWM2_MOD2
bool "FLEXPWM2 Module 2"
default n
if IMXRT_FLEXPWM2_MOD2
config IMXRT_FLEXPWM2_MOD2_COMP
bool "Use complementary output"
default n
endif
config IMXRT_FLEXPWM2_MOD3
bool "FLEXPWM2 Module 3"
default n
if IMXRT_FLEXPWM2_MOD3
config IMXRT_FLEXPWM2_MOD3_COMP
bool "Use complementary output"
default n
endif
config IMXRT_FLEXPWM2_MOD4
bool "FLEXPWM2 Module 4"
default n
if IMXRT_FLEXPWM2_MOD4
config IMXRT_FLEXPWM2_MOD4_COMP
bool "Use complementary output"
default n
endif
endmenu # IMXRT_FLEXPWM2
menu "FLEXPWM3 Configuration"
depends on IMXRT_FLEXPWM3
config IMXRT_FLEXPWM3_MOD1
bool "FLEXPWM3 Module 1"
default n
if IMXRT_FLEXPWM3_MOD1
config IMXRT_FLEXPWM3_MOD1_COMP
bool "Use complementary output"
default n
endif
config IMXRT_FLEXPWM3_MOD2
bool "FLEXPWM3 Module 2"
default n
if IMXRT_FLEXPWM3_MOD2
config IMXRT_FLEXPWM3_MOD2_COMP
bool "Use complementary output"
default n
endif
config IMXRT_FLEXPWM3_MOD3
bool "FLEXPWM3 Module 3"
default n
if IMXRT_FLEXPWM3_MOD3
config IMXRT_FLEXPWM3_MOD3_COMP
bool "Use complementary output"
default n
endif
config IMXRT_FLEXPWM3_MOD4
bool "FLEXPWM3 Module 4"
default n
if IMXRT_FLEXPWM3_MOD4
config IMXRT_FLEXPWM3_MOD4_COMP
bool "Use complementary output"
default n
endif
endmenu # IMXRT_FLEXPWM3
menu "FLEXPWM4 Configuration"
depends on IMXRT_FLEXPWM4
config IMXRT_FLEXPWM4_MOD1
bool "FLEXPWM4 Module 1"
default n
if IMXRT_FLEXPWM4_MOD1
config IMXRT_FLEXPWM4_MOD1_COMP
bool "Use complementary output"
default n
endif
config IMXRT_FLEXPWM4_MOD2
bool "FLEXPWM4 Module 2"
default n
if IMXRT_FLEXPWM4_MOD2
config IMXRT_FLEXPWM4_MOD2_COMP
bool "Use complementary output"
default n
endif
config IMXRT_FLEXPWM4_MOD3
bool "FLEXPWM4 Module 3"
default n
if IMXRT_FLEXPWM4_MOD3
config IMXRT_FLEXPWM4_MOD3_COMP
bool "Use complementary output"
default n
endif
config IMXRT_FLEXPWM4_MOD4
bool "FLEXPWM4 Module 4"
default n
if IMXRT_FLEXPWM4_MOD4
config IMXRT_FLEXPWM4_MOD4_COMP
bool "Use complementary output"
default n
endif
endmenu # IMXRT_FLEXPWM4
menu "LPI2C Peripherals"
menuconfig IMXRT_LPI2C1
+4
View File
@@ -116,6 +116,10 @@ ifeq ($(CONFIG_IMXRT_FLEXCAN),y)
CHIP_CSRCS += imxrt_flexcan.c
endif
ifeq ($(CONFIG_IMXRT_FLEXPWM),y)
CHIP_CSRCS += imxrt_flexpwm.c
endif
ifeq ($(CONFIG_IMXRT_SNVS_LPSRTC),y)
CHIP_CSRCS += imxrt_lpsrtc.c
CHIP_CSRCS += imxrt_hprtc.c
@@ -154,6 +154,9 @@
#define IOMUX_CAN_DEFAULT (IOMUX_SLEW_SLOW | \
IOMUX_DRIVE_50OHM | IOMUX_SPEED_LOW )
#define IOMUX_PWM_DEFAULT (IOMUX_SLEW_FAST | \
IOMUX_DRIVE_50OHM | IOMUX_SPEED_LOW )
#define IOMUX_USDHC1_DATAX_DEFAULT (IOMUX_SLEW_FAST | IOMUX_DRIVE_130OHM | \
IOMUX_PULL_UP_47K | IOMUX_SCHMITT_TRIGGER)
#define IOMUX_USDHC1_CMD_DEFAULT (IOMUX_SLEW_FAST | IOMUX_DRIVE_130OHM | \
File diff suppressed because it is too large Load Diff
+78
View File
@@ -0,0 +1,78 @@
/****************************************************************************
* arch/arm/src/imxrt/imxrt_flexpwm.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_IMXRT_IMXRT_FLEXPWM_H
#define __ARCH_ARM_SRC_IMXRT_IMXRT_FLEXPWM_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/timers/pwm.h>
#include "hardware/imxrt_flexpwm.h"
#ifdef CONFIG_IMXRT_FLEXPWM
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Function: imxrt_pwminitialize
*
* Description:
* Initialize the PWM module for use with the upper level PWM driver.
*
* Input Parameters:
* pwm - a number identifying the PWM driver.
*
* Returned Value:
* A pointer to the lower half PWM driver is returned on success,
* NULL on failure.
*
****************************************************************************/
FAR struct pwm_lowerhalf_s *imxrt_pwminitialize(int pwm);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* CONFIG_IMXRT_FLEXPWM */
#endif /* __ARCH_ARM_SRC_IMXRT_IMXRT_FLEXPWM_H */