imxrt: add option to select PWM trigger source value from configuration

Current implementation supports the trigger generation only from timer
capture on period value. This is sufficient for PWM synchronization but
may not be enough for other purposes as ADC triggering for example.

This change adds an option to generate the trigger based on a duty
cycle value.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
Michal Lenc
2023-02-11 01:07:03 +01:00
committed by Xiang Xiao
parent ac50b3a473
commit 00e87962fd
3 changed files with 419 additions and 37 deletions
+4 -1
View File
@@ -181,7 +181,7 @@ Output on pin B is currently supported only as a complementary option to pin A.
The lower-half of this driver is initialize by calling :c:func:`imxrt_pwminitialize`.
PWM module can be synchronized by an external signal. The external signal used for synchronization
is selected by IMXRT_FLEXPWMx_MODx_SYNC_SRC config option. The number in IMXRT_FLEXPWM4_MOD4_SYNC_SRC
is selected by IMXRT_FLEXPWMx_MODx_SYNC_SRC config option. The number in IMXRT_FLEXPWMx_MODx_SYNC_SRC
corresponds with the XBAR number. Following numbers can be used for synchronization of PWMs with other
PWM module when using iMXRT1020, iMXRT1050 or iMXRT1060.
@@ -221,6 +221,9 @@ iMXRT1170 has different XBAR connections:
- PWM4 Module 3 = 88
- PWM4 Module 4 = 89
Option IMXRT_FLEXPWMx_MODx_TRIG allows the module to generate a trigger signal. The trigger is generated on
timer capture of either period or duty cycle value based on the configuration.
SAI
---
+272
View File
@@ -601,6 +601,23 @@ config IMXRT_FLEXPWM1_MOD1_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM1_MOD1_TRIG_PER
depends on IMXRT_FLEXPWM1_MOD1_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM1_MOD1_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM1_MOD1_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM1_MOD1_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -634,6 +651,23 @@ config IMXRT_FLEXPWM1_MOD2_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM1_MOD2_TRIG_PER
depends on IMXRT_FLEXPWM1_MOD1_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM1_MOD2_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM1_MOD2_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM1_MOD2_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -667,6 +701,23 @@ config IMXRT_FLEXPWM1_MOD3_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM1_MOD3_TRIG_PER
depends on IMXRT_FLEXPWM1_MOD3_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM1_MOD3_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM1_MOD3_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM1_MOD3_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -700,6 +751,23 @@ config IMXRT_FLEXPWM1_MOD4_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM1_MOD4_TRIG_PER
depends on IMXRT_FLEXPWM1_MOD4_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM1_MOD4_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM1_MOD4_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM1_MOD4_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -738,6 +806,23 @@ config IMXRT_FLEXPWM2_MOD1_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM2_MOD1_TRIG_PER
depends on IMXRT_FLEXPWM2_MOD1_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM2_MOD1_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM2_MOD1_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM2_MOD1_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -771,6 +856,23 @@ config IMXRT_FLEXPWM2_MOD2_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM2_MOD2_TRIG_PER
depends on IMXRT_FLEXPWM2_MOD2_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM2_MOD2_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM2_MOD2_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM2_MOD2_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -804,6 +906,23 @@ config IMXRT_FLEXPWM2_MOD3_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM2_MOD3_TRIG_PER
depends on IMXRT_FLEXPWM2_MOD3_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM2_MOD3_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM2_MOD3_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM2_MOD3_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -837,6 +956,23 @@ config IMXRT_FLEXPWM2_MOD4_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM2_MOD4_TRIG_PER
depends on IMXRT_FLEXPWM2_MOD1_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM2_MOD4_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM2_MOD4_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM2_MOD4_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -875,6 +1011,23 @@ config IMXRT_FLEXPWM3_MOD1_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM3_MOD1_TRIG_PER
depends on IMXRT_FLEXPWM3_MOD1_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM3_MOD1_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM3_MOD1_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM3_MOD1_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -908,6 +1061,23 @@ config IMXRT_FLEXPWM3_MOD2_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM3_MOD2_TRIG_PER
depends on IMXRT_FLEXPWM3_MOD2_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM3_MOD2_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM3_MOD2_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM3_MOD2_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -941,6 +1111,23 @@ config IMXRT_FLEXPWM3_MOD3_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM3_MOD3_TRIG_PER
depends on IMXRT_FLEXPWM3_MOD3_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM3_MOD3_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM3_MOD3_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM3_MOD3_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -974,6 +1161,23 @@ config IMXRT_FLEXPWM3_MOD4_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM3_MOD4_TRIG_PER
depends on IMXRT_FLEXPWM3_MOD4_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM3_MOD4_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM3_MOD4_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM3_MOD4_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -1012,6 +1216,23 @@ config IMXRT_FLEXPWM4_MOD1_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM4_MOD1_TRIG_PER
depends on IMXRT_FLEXPWM4_MOD1_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM4_MOD1_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM4_MOD1_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM4_MOD1_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -1045,6 +1266,23 @@ config IMXRT_FLEXPWM4_MOD2_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM4_MOD2_TRIG_PER
depends on IMXRT_FLEXPWM4_MOD2_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM4_MOD2_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM4_MOD2_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM4_MOD2_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -1078,6 +1316,23 @@ config IMXRT_FLEXPWM4_MOD3_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM4_MOD3_TRIG_PER
depends on IMXRT_FLEXPWM4_MOD3_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM4_MOD3_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM4_MOD3_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM4_MOD3_SYNC_SRC
int "Synchronization source signal"
default -1
@@ -1111,6 +1366,23 @@ config IMXRT_FLEXPWM4_MOD4_TRIG
interrupt that can trigger ADC conversion or synchronize
other PWMs for example.
choice
prompt "Trigger value source"
default IMXRT_FLEXPWM4_MOD4_TRIG_PER
depends on IMXRT_FLEXPWM4_MOD4_TRIG
---help---
PWM can use either duty cycle value or period value register
to generate the trigger. The trigger is generated when the timer
reaches the corresponding value.
config IMXRT_FLEXPWM4_MOD4_TRIG_PER
bool "Period value"
config IMXRT_FLEXPWM4_MOD4_TRIG_DUTY
bool "Duty cycle value"
endchoice
config IMXRT_FLEXPWM4_MOD4_SYNC_SRC
int "Synchronization source signal"
default -1
+143 -36
View File
@@ -79,7 +79,7 @@ struct imxrt_flexpwm_module_s
{
uint8_t module; /* Number of PWM module */
bool used; /* True if the module is used */
bool trig_en;
uint8_t trig_val; /* 0: invalid, 1: period, 2: duty */
struct imxrt_flexpwm_out_s out_a; /* PWM output */
struct imxrt_flexpwm_out_s out_b; /* PWM output */
bool complementary; /* True if outputs are complementary */
@@ -139,9 +139,15 @@ static struct imxrt_flexpwm_module_s g_pwm1_modules[] =
.module = 1,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM1_MOD1_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM1_MOD1_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM1_MOD1_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -167,9 +173,15 @@ static struct imxrt_flexpwm_module_s g_pwm1_modules[] =
.module = 2,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM1_MOD2_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM1_MOD2_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM1_MOD2_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -195,9 +207,15 @@ static struct imxrt_flexpwm_module_s g_pwm1_modules[] =
.module = 3,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM1_MOD3_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM1_MOD3_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM1_MOD3_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -223,9 +241,15 @@ static struct imxrt_flexpwm_module_s g_pwm1_modules[] =
.module = 4,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM1_MOD4_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM1_MOD4_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM1_MOD4_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -269,9 +293,15 @@ static struct imxrt_flexpwm_module_s g_pwm2_modules[] =
.module = 1,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM2_MOD1_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM2_MOD1_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM2_MOD1_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -297,9 +327,15 @@ static struct imxrt_flexpwm_module_s g_pwm2_modules[] =
.module = 2,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM2_MOD2_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM2_MOD2_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM2_MOD2_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -325,9 +361,15 @@ static struct imxrt_flexpwm_module_s g_pwm2_modules[] =
.module = 3,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM2_MOD3_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM2_MOD3_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM2_MOD3_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -353,9 +395,15 @@ static struct imxrt_flexpwm_module_s g_pwm2_modules[] =
.module = 4,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM2_MOD4_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM2_MOD4_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM2_MOD4_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -399,9 +447,15 @@ static struct imxrt_flexpwm_module_s g_pwm3_modules[] =
.module = 1,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM3_MOD1_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM3_MOD1_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM3_MOD1_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -427,9 +481,15 @@ static struct imxrt_flexpwm_module_s g_pwm3_modules[] =
.module = 2,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM3_MOD2_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM3_MOD2_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM3_MOD2_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -455,9 +515,15 @@ static struct imxrt_flexpwm_module_s g_pwm3_modules[] =
.module = 3,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM3_MOD3_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM3_MOD3_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM3_MOD3_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -483,9 +549,15 @@ static struct imxrt_flexpwm_module_s g_pwm3_modules[] =
.module = 4,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM3_MOD4_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM3_MOD4_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM3_MOD4_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -529,9 +601,15 @@ static struct imxrt_flexpwm_module_s g_pwm4_modules[] =
.module = 1,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM4_MOD1_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM4_MOD1_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM4_MOD1_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -557,9 +635,15 @@ static struct imxrt_flexpwm_module_s g_pwm4_modules[] =
.module = 2,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM4_MOD2_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM4_MOD2_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM4_MOD2_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -585,9 +669,15 @@ static struct imxrt_flexpwm_module_s g_pwm4_modules[] =
.module = 3,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM4_MOD3_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM4_MOD3_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM4_MOD3_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -613,9 +703,15 @@ static struct imxrt_flexpwm_module_s g_pwm4_modules[] =
.module = 4,
.used = true,
#ifdef CONFIG_IMXRT_FLEXPWM4_MOD4_TRIG
.trig_en = true,
#ifdef CONFIG_IMXRT_FLEXPWM4_MOD4_TRIG_PER
.trig_val = 1,
#elif CONFIG_IMXRT_FLEXPWM4_MOD4_TRIG_DUTY
.trig_val = 2,
#else
.trig_en = false,
.trig_val = 0,
#endif
#else
.trig_val = 0,
#endif
.out_a =
{
@@ -957,13 +1053,24 @@ static int pwm_setup(struct pwm_lowerhalf_s *dev)
}
}
if (priv->modules[i].trig_en)
if (priv->modules[i].trig_val != 0)
{
/* Use period register for trigger generation */
/* Use either period or duty cycle register for
* trigger generation
*/
regval = getreg16(priv->base + IMXRT_FLEXPWM_SM0TCTRL_OFFSET
+ MODULE_OFFSET * shift);
regval |= SMT_OUT_TRIG_EN_VAL1;
if (priv->modules[i].trig_val == 1)
{
regval |= SMT_OUT_TRIG_EN_VAL1;
}
if (priv->modules[i].trig_val == 2)
{
regval |= SMT_OUT_TRIG_EN_VAL3;
}
putreg16(regval, priv->base + IMXRT_FLEXPWM_SM0TCTRL_OFFSET
+ MODULE_OFFSET * shift);
}