!drivers/pwm: remove PWM_MULTICHAN option

BREAKING CHANGE: remove PWM_MULTICHAN option

PWM_MULTICHAN option is redundant, we can just set CONFIG_PWM_NCHANNELS > 1.
At default CONFIG_PWM_NCHANNELS is set to 1, so the default behavior is preserved.
Access to single channel API is now `info->channels[0].XXX` instead of `info->XXX`

This is the first step to simplify PWM implementation and make it more portable.

Signed-off-by: raiden00pl <raiden00@railab.me>
This commit is contained in:
raiden00pl
2025-01-10 10:41:22 +01:00
committed by Matteo Golin
parent 7a04cddb78
commit 4df80e1928
105 changed files with 333 additions and 951 deletions
-5
View File
@@ -319,7 +319,6 @@ config ARCH_CHIP_NRF52
#select ARM_HAVE_MPU_UNIFIED
select ARCH_HAVE_SPI_BITORDER
select ARCH_HAVE_FPU
select ARCH_HAVE_PWM_MULTICHAN
select ARCH_HAVE_SERIAL_TERMIOS
select ARCH_DMA_NO_FLASH_TRANSFER
---help---
@@ -328,7 +327,6 @@ config ARCH_CHIP_NRF52
config ARCH_CHIP_NRF53
bool "Nordic nRF53"
select ARCH_CORTEXM33
select ARCH_HAVE_PWM_MULTICHAN
select ARCH_DMA_NO_FLASH_TRANSFER
depends on EXPERIMENTAL
---help---
@@ -337,7 +335,6 @@ config ARCH_CHIP_NRF53
config ARCH_CHIP_NRF91
bool "Nordic nRF91"
select ARCH_CORTEXM33
select ARCH_HAVE_PWM_MULTICHAN
select ARCH_HAVE_TRUSTZONE
select ARCH_HAVE_TICKLESS
select ARCH_DMA_NO_FLASH_TRANSFER
@@ -373,7 +370,6 @@ config ARCH_CHIP_RP2040
select ARCH_HAVE_MULTICPU
select ARCH_HAVE_I2CRESET
select ARM_HAVE_WFE_SEV
select ARCH_HAVE_PWM_MULTICHAN
select ARCH_BOARD_COMMON
select ARCH_HAVE_CUSTOM_TESTSET
---help---
@@ -389,7 +385,6 @@ config ARCH_CHIP_RP23XX
select ARM_HAVE_DSP
select ARCH_HAVE_FPU
select ARCH_HAVE_CUSTOM_TESTSET
select ARCH_HAVE_PWM_MULTICHAN
select ARCH_BOARD_COMMON
---help---
Raspberry Pi RP23XX architectures (ARM dual Cortex-M33 or RISC-V).
-1
View File
@@ -3651,7 +3651,6 @@ config AT32_PWM_MULTICHAN
bool "PWM Multiple Output Channels"
default n
depends on AT32_PWM
select ARCH_HAVE_PWM_MULTICHAN
---help---
Specifies that the PWM driver supports multiple output
channels per timer.
+14 -42
View File
@@ -2168,11 +2168,6 @@ static int pwm_duty_update(struct pwm_lowerhalf_s *dev, uint8_t channel,
pwminfo("TIM%u channel: %u duty: %08" PRIx32 "\n",
priv->timid, channel, duty);
#ifndef CONFIG_PWM_MULTICHAN
DEBUGASSERT(channel == priv->channels[0].channel);
DEBUGASSERT(duty >= 0 && duty < uitoub16(100));
#endif
/* Get the reload values */
reload = pwm_arr_get(dev);
@@ -3219,13 +3214,13 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
pwminfo("TIM%u channel: %u frequency: %" PRIx32 " duty: %08" PRIx32
" count: %" PRIx32 "\n",
priv->timid, priv->channels[0].channel, info->frequency,
info->duty, info->count);
info->channels[0].duty, info->channels[0].count);
DEBUGASSERT(info->frequency > 0);
/* Channel specific setup */
duty = info->duty;
duty = info->channels[0].duty;
channel = priv->channels[0].channel;
/* Disable all interrupts and DMA requests, clear all pending status */
@@ -3254,7 +3249,7 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* assured us that the count value is within range).
*/
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Save the remaining count and the number of counts that will have
* elapsed on the first interrupt.
@@ -3265,7 +3260,7 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* value.
*/
priv->prev = pwm_pulsecount(info->count);
priv->prev = pwm_pulsecount(info->channels[0].count);
pwm_rcr_update(dev, priv->prev - 1);
/* Generate an update event to reload the prescaler. This should
@@ -3278,8 +3273,8 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* update event.
*/
priv->count = info->count;
priv->curr = pwm_pulsecount(info->count - priv->prev);
priv->count = info->channels[0].count;
priv->curr = pwm_pulsecount(info->channels[0].count - priv->prev);
pwm_rcr_update(dev, priv->curr - 1);
}
@@ -3308,12 +3303,13 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
goto errout;
}
/* Setup update interrupt. If info->count is > 0, then we can be
* assured that pwm_pulsecount_start() has already verified: (1) that this
* is an advanced timer, and that (2) the repetition count is within range.
/* Setup update interrupt. If info->channels[0].count is > 0, then we can
* be assured that pwm_pulsecount_start() has already verified: (1) that
* this is an advanced timer, and that (2) the repetition count is within
* range.
*/
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Clear all pending interrupts and enable the update interrupt. */
@@ -3467,16 +3463,11 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
uint8_t channel = 0;
ub16_t duty = 0;
int ret = OK;
#ifdef CONFIG_PWM_MULTICHAN
int i = 0;
int j = 0;
#endif
#ifdef CONFIG_PWM_MULTICHAN
for (i = 0; i < CONFIG_PWM_NCHANNELS; i++)
#endif
{
#ifdef CONFIG_PWM_MULTICHAN
/* Break the loop if all following channels are not configured */
if (info->channels[i].channel == -1)
@@ -3509,10 +3500,6 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
ret = -EINVAL;
goto errout;
}
#else
duty = info->duty;
channel = priv->channels[0].channel;
#endif
/* Update duty cycle */
@@ -3521,9 +3508,7 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
{
goto errout;
}
#ifdef CONFIG_PWM_MULTICHAN
}
#endif
}
errout:
@@ -3554,19 +3539,10 @@ static int pwm_timer(struct pwm_lowerhalf_s *dev,
DEBUGASSERT(priv != NULL && info != NULL);
#if defined(CONFIG_PWM_MULTICHAN)
pwminfo("TIM%u frequency: %" PRIu32 "\n",
priv->timid, info->frequency);
#else
pwminfo("TIM%u channel: %u frequency: %" PRIu32 " duty: %08" PRIx32 "\n",
priv->timid, priv->channels[0].channel,
info->frequency, info->duty);
#endif
DEBUGASSERT(info->frequency > 0);
#ifndef CONFIG_PWM_MULTICHAN
DEBUGASSERT(info->duty >= 0 && info->duty < uitoub16(100));
#endif
/* TODO: what if we have pwm running and we want disable some channels ? */
@@ -4172,14 +4148,14 @@ static int pwm_start_pulsecount(struct pwm_lowerhalf_s *dev,
/* Generate an indefinite number of pulses */
if (info->count == 0)
if (info->channels[0].count == 0)
{
return pwm_start(dev, info);
}
/* Check if a pulsecount has been selected */
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Only the advanced timers (TIM1,8 can support the pulse counting)
* REVISIT: verify if TIMTYPE_COUNTUP16_N works with it
@@ -4188,7 +4164,7 @@ static int pwm_start_pulsecount(struct pwm_lowerhalf_s *dev,
if (priv->timtype != TIMTYPE_ADVANCED)
{
pwmerr("ERROR: TIM%u cannot support pulse count: %" PRIx32 "\n",
priv->timid, info->count);
priv->timid, info->channels[0].count);
return -EPERM;
}
}
@@ -4213,7 +4189,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
if (info->frequency == priv->frequency)
{
#ifdef CONFIG_PWM_MULTICHAN
int i;
for (i = 0; ret == OK && i < CONFIG_PWM_NCHANNELS; i++)
@@ -4233,9 +4208,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
info->channels[i].duty);
}
}
#else
ret = pwm_duty_update(dev, priv->channels[0].channel, info->duty);
#endif /* CONFIG_PWM_MULTICHAN */
}
else
{
+1 -1
View File
@@ -358,7 +358,7 @@
PWM_TIM20_CHANNEL3 + PWM_TIM20_CHANNEL4 + \
PWM_TIM20_CHANNEL5 + PWM_TIM20_CHANNEL6)
#else /* !CONFIG_PWM_MULTICHAN */
#else /* !CONFIG_AT32_PWM_MULTICHAN */
/* For each timer that is enabled for PWM usage, we need the following
* additional configuration settings:
+4 -3
View File
@@ -394,13 +394,13 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
uint32_t phase;
int ret;
if (info->duty <= 0)
if (info->channels[0].duty <= 0)
{
/* Output low level if duty cycle is almost 0% */
PWM_REG(priv->ch)->EN = 0x0;
}
else if (info->duty >= 65536)
else if (info->channels[0].duty >= 65536)
{
/* Output high level if duty cycle is almost 100% */
@@ -409,7 +409,8 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
}
else
{
ret = convert_freq2period(info->frequency, info->duty, &param, &phase);
ret = convert_freq2period(info->frequency, info->channels[0].duty,
&param, &phase);
if (ret < 0)
{
return -EINVAL;
+7 -5
View File
@@ -360,13 +360,14 @@ static int pwm_timer(struct efm32_pwmtimer_s *priv,
#ifdef CONFIG_PWM_PULSECOUNT
pwminfo("TIMER%d channel: %d frequency: %d duty: %08x count: %d\n",
priv->timid, priv->channel, info->frequency,
info->duty, info->count);
info->channels[0].duty, info->channels[0].count);
#else
pwminfo("TIMER%d channel: %d frequency: %d duty: %08x\n",
priv->timid, priv->channel, info->frequency, info->duty);
priv->timid, priv->channel, info->frequency,
info->channels[0].duty);
#endif
DEBUGASSERT(info->frequency > 0 && info->duty >= 0 &&
info->duty < uitoub16(100));
DEBUGASSERT(info->frequency > 0 && info->channels[0].duty >= 0 &&
info->channels[0].duty < uitoub16(100));
efm32_timer_reset(priv->base);
@@ -403,7 +404,8 @@ static int pwm_timer(struct efm32_pwmtimer_s *priv,
pwm_putreg(priv, EFM32_TIMER_ROUTE_OFFSET, regval);
regval = (info->duty * pwm_getreg(priv, EFM32_TIMER_TOP_OFFSET)) >> 16;
regval = (info->channels[0].duty *
pwm_getreg(priv, EFM32_TIMER_TOP_OFFSET)) >> 16;
pwm_putreg(priv, cc_offet + EFM32_TIMER_CC_CCV_OFFSET, regval);
/* pwm_putreg(priv, cc_offet + EFM32_TIMER_CC_CCVB_OFFSET, regval); */
+10 -10
View File
@@ -63,7 +63,7 @@ config HT32F491X3_TMR1
config HT32F491X3_TMR1_PWM
bool "TMR1 PWM output"
default n
depends on HT32F491X3_TMR1 && PWM && !PWM_MULTICHAN
depends on HT32F491X3_TMR1 && PWM && PWM_NCHANNELS = 1
---help---
Enable lower-half PWM support on TMR1.
@@ -85,7 +85,7 @@ config HT32F491X3_TMR2
config HT32F491X3_TMR2_PWM
bool "TMR2 PWM output"
default n
depends on HT32F491X3_TMR2 && PWM && !PWM_MULTICHAN
depends on HT32F491X3_TMR2 && PWM && PWM_NCHANNELS = 1
---help---
Enable lower-half PWM support on TMR2.
@@ -107,7 +107,7 @@ config HT32F491X3_TMR3
config HT32F491X3_TMR3_PWM
bool "TMR3 PWM output"
default n
depends on HT32F491X3_TMR3 && PWM && !PWM_MULTICHAN
depends on HT32F491X3_TMR3 && PWM && PWM_NCHANNELS = 1
---help---
Enable lower-half PWM support on TMR3.
@@ -129,7 +129,7 @@ config HT32F491X3_TMR4
config HT32F491X3_TMR4_PWM
bool "TMR4 PWM output"
default n
depends on HT32F491X3_TMR4 && PWM && !PWM_MULTICHAN
depends on HT32F491X3_TMR4 && PWM && PWM_NCHANNELS = 1
---help---
Enable lower-half PWM support on TMR4.
@@ -165,7 +165,7 @@ config HT32F491X3_TMR9
config HT32F491X3_TMR9_PWM
bool "TMR9 PWM output"
default n
depends on HT32F491X3_TMR9 && PWM && !PWM_MULTICHAN
depends on HT32F491X3_TMR9 && PWM && PWM_NCHANNELS = 1
---help---
Enable lower-half PWM support on TMR9.
@@ -187,7 +187,7 @@ config HT32F491X3_TMR10
config HT32F491X3_TMR10_PWM
bool "TMR10 PWM output"
default n
depends on HT32F491X3_TMR10 && PWM && !PWM_MULTICHAN
depends on HT32F491X3_TMR10 && PWM && PWM_NCHANNELS = 1
---help---
Enable lower-half PWM support on TMR10.
@@ -208,7 +208,7 @@ config HT32F491X3_TMR11
config HT32F491X3_TMR11_PWM
bool "TMR11 PWM output"
default n
depends on HT32F491X3_TMR11 && PWM && !PWM_MULTICHAN
depends on HT32F491X3_TMR11 && PWM && PWM_NCHANNELS = 1
---help---
Enable lower-half PWM support on TMR11.
@@ -229,7 +229,7 @@ config HT32F491X3_TMR12
config HT32F491X3_TMR12_PWM
bool "TMR12 PWM output"
default n
depends on HT32F491X3_TMR12 && PWM && !PWM_MULTICHAN
depends on HT32F491X3_TMR12 && PWM && PWM_NCHANNELS = 1
---help---
Enable lower-half PWM support on TMR12.
@@ -251,7 +251,7 @@ config HT32F491X3_TMR13
config HT32F491X3_TMR13_PWM
bool "TMR13 PWM output"
default n
depends on HT32F491X3_TMR13 && PWM && !PWM_MULTICHAN
depends on HT32F491X3_TMR13 && PWM && PWM_NCHANNELS = 1
---help---
Enable lower-half PWM support on TMR13.
@@ -272,7 +272,7 @@ config HT32F491X3_TMR14
config HT32F491X3_TMR14_PWM
bool "TMR14 PWM output"
default n
depends on HT32F491X3_TMR14 && PWM && !PWM_MULTICHAN
depends on HT32F491X3_TMR14 && PWM && PWM_NCHANNELS = 1
---help---
Enable lower-half PWM support on TMR14.
+8 -7
View File
@@ -73,13 +73,13 @@ struct ht32f491x3_pwmcfg_s
struct ht32f491x3_pwmtimer_s
{
const struct pwm_ops_s *ops;
const struct pwm_ops_s *ops;
FAR const struct ht32f491x3_pwmcfg_s *cfg;
uint32_t gpio_clken;
uintptr_t gpio_base;
uint8_t channel;
uint8_t pin;
uint8_t af;
uint32_t gpio_clken;
uintptr_t gpio_base;
uint8_t channel;
uint8_t pin;
uint8_t af;
};
/****************************************************************************
@@ -345,7 +345,8 @@ static int pwm_timer(FAR struct ht32f491x3_pwmtimer_s *priv,
}
reload -= 1u;
pulse = (uint32_t)(((uint64_t)reload * info->duty + 0x8000ull) >> 16);
pulse = (uint32_t)(((uint64_t)reload *
info->channels[0].duty + 0x8000ull) >> 16);
if (pulse > reload)
{
pulse = reload;
-1
View File
@@ -298,7 +298,6 @@ config IMXRT_FLEXCAN2_FD
config IMXRT_FLEXPWM
bool
default n
select ARCH_HAVE_PWM_MULTICHAN
config IMXRT_LPI2C
bool
-29
View File
@@ -808,11 +808,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
uint8_t channel)
{
struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
#ifdef CONFIG_PWM_MULTICHAN
uint8_t shift = (info->channels[channel].channel - 1) >> 1;
#else
uint8_t shift = priv->modules[0].module - 1;
#endif
uint16_t regval;
uint16_t olddiv = getreg16(priv->base + IMXRT_FLEXPWM_SM0VAL1_OFFSET
+ MODULE_OFFSET * shift);
@@ -1219,7 +1215,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
{
for (int i = 0; i < PWM_NCHANNELS; i++)
{
#ifdef CONFIG_PWM_MULTICHAN
/* Break the loop if all following channels are not configured */
if (info->channels[i].channel == -1)
@@ -1233,9 +1228,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
{
ret = pwm_change_freq(dev, info, i);
}
#else
ret = pwm_change_freq(dev, info, i);
#endif
}
/* Save current frequency */
@@ -1246,7 +1238,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
}
}
#ifdef CONFIG_PWM_MULTICHAN
for (int i = 0; ret == OK && i < PWM_NCHANNELS; i++)
{
/* Break the loop if all following channels are not configured */
@@ -1268,15 +1259,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
ldok_map |= 1 << ((info->channels[i].channel - 1) >> 1);
}
}
#else
/* Enable PWM output just for first channel */
ret = pwm_set_output(dev, priv->modules[0].module, info->duty);
/* Remember the channel number in bitmap */
ldok_map = 1 << (priv->modules[0].module - 1);
#endif /* CONFIG_PWM_MULTICHAN */
/* Set Load Okay bits */
@@ -1312,7 +1294,6 @@ static int pwm_stop(struct pwm_lowerhalf_s *dev)
uint8_t shift;
uint16_t regval;
#ifdef CONFIG_PWM_MULTICHAN
for (int i = 0; i < priv->modules_num; i++)
{
/* Skip settings if channel is not configured */
@@ -1330,16 +1311,6 @@ static int pwm_stop(struct pwm_lowerhalf_s *dev)
regval = OUTEN_PWMB_EN(0 << shift);
putreg16(regval, priv->base + IMXRT_FLEXPWM_OUTEN_OFFSET);
}
#else
shift = priv->modules[0].module - 1;
regval = OUTEN_PWMA_EN(0 << shift);
putreg16(regval, priv->base + IMXRT_FLEXPWM_OUTEN_OFFSET);
regval = OUTEN_PWMB_EN(0 << shift);
putreg16(regval, priv->base + IMXRT_FLEXPWM_OUTEN_OFFSET);
#endif /* CONFIG_PWM_MULTICHAN */
return OK;
}
+5 -4
View File
@@ -365,10 +365,11 @@ static int pwm_timer(struct kinetis_pwmtimer_s *priv,
DEBUGASSERT(priv != NULL && info != NULL);
pwminfo("FTM%d channel: %d frequency: %" PRId32 " duty: %08" PRIx32 "\n",
priv->tpmid, priv->channel, info->frequency, info->duty);
priv->tpmid, priv->channel, info->frequency,
info->channels[0].duty);
DEBUGASSERT(info->frequency > 0 && info->duty > 0 &&
info->duty < uitoub16(100));
DEBUGASSERT(info->frequency > 0 && info->channels[0].duty > 0 &&
info->channels[0].duty < uitoub16(100));
/* Calculate optimal values for the timer prescaler and for the timer
* modulo register. If' frequency' is the desired frequency, then
@@ -432,7 +433,7 @@ static int pwm_timer(struct kinetis_pwmtimer_s *priv,
* duty cycle = cv / modulo (fractional value)
*/
cv = b16toi(info->duty * modulo + b16HALF);
cv = b16toi(info->channels[0].duty * modulo + b16HALF);
pwminfo("FTM%d PCLK: %" PRId32 " frequency: %" PRIx32 " FTMCLK: %" PRIx32
" prescaler: %d modulo: %" PRId32 " c0v: %" PRId32 "\n",
+5 -4
View File
@@ -331,10 +331,11 @@ static int pwm_timer(struct kl_pwmtimer_s *priv,
DEBUGASSERT(priv != NULL && info != NULL);
pwminfo("TPM%d channel: %d frequency: %" PRId32 " duty: %08" PRIx32 "\n",
priv->tpmid, priv->channel, info->frequency, info->duty);
priv->tpmid, priv->channel, info->frequency,
info->channels[0].duty);
DEBUGASSERT(info->frequency > 0 && info->duty > 0 &&
info->duty < uitoub16(100));
DEBUGASSERT(info->frequency > 0 && info->channels[0].duty > 0 &&
info->channels[0].duty < uitoub16(100));
/* Calculate optimal values for the timer prescaler and for the timer
* modulo register. If' frequency' is the desired frequency, then
@@ -398,7 +399,7 @@ static int pwm_timer(struct kl_pwmtimer_s *priv,
* duty cycle = cv / modulo (fractional value)
*/
cv = b16toi(info->duty * modulo + b16HALF);
cv = b16toi(info->channels[0].duty * modulo + b16HALF);
pwminfo("TPM%d PCLK: %" PRId32 " frequency: %" PRId32 " TPMCLK: %" PRId32
" prescaler: %d modulo: %" PRId32 " c0v: %" PRId32 "\n",
-1
View File
@@ -348,7 +348,6 @@ config LPC17_40_PWM0
config LPC17_40_PWM1
bool "PWM1"
select ARCH_HAVE_PWM_MULTICHAN
default n
config LPC17_40_PWM1_PIN
+7 -2
View File
@@ -268,8 +268,13 @@ static int mcpwm_timer(struct lpc17_40_mcpwmtimer_s *priv,
flags = enter_critical_section();
putreg32(info->frequency, LPC17_40_MCPWM_LIM0); /* Set PWMMR0 = number of counts */
putreg32(info->duty, LPC17_40_MCPWM_MAT0); /* Set PWM cycle */
/* Set PWMMR0 = number of counts */
putreg32(info->frequency, LPC17_40_MCPWM_LIM0);
/* Set PWM cycle */
putreg32(info->channels[0].duty, LPC17_40_MCPWM_MAT0);
leave_critical_section(flags);
mcpwm_dumpregs(priv, "After starting");
-6
View File
@@ -296,7 +296,6 @@ static void pwm_dumpregs(struct lpc17_40_pwmtimer_s *priv,
pwm_getreg(priv, LPC17_40_PWM_PC_OFFSET));
pwminfo(" MCR: %04x\n",
pwm_getreg(priv, LPC17_40_PWM_MCR_OFFSET));
#ifdef CONFIG_PWM_MULTICHAN
pwminfo(" 0: %08x 1: %08x 2: %08x 3: %08x\n",
pwm_getreg(priv, LPC17_40_PWM_MR0_OFFSET),
pwm_getreg(priv, LPC17_40_PWM_MR1_OFFSET),
@@ -306,7 +305,6 @@ static void pwm_dumpregs(struct lpc17_40_pwmtimer_s *priv,
pwm_getreg(priv, LPC17_40_PWM_MR4_OFFSET),
pwm_getreg(priv, LPC17_40_PWM_MR5_OFFSET),
pwm_getreg(priv, LPC17_40_PWM_MR6_OFFSET));
#endif
}
#endif
@@ -341,9 +339,6 @@ static int pwm_timer(struct lpc17_40_pwmtimer_s *priv,
putreg32(mr0_freq, LPC17_40_PWM1_MR0); /* Set PWMMR0 = number of counts */
#ifndef CONFIG_PWM_MULTICHAN
putreg32(info->duty, LPC17_40_PWM1_MR1); /* Set PWM cycle */
#else
for (i = 0; i < CONFIG_PWM_NCHANNELS; i++)
{
switch (priv->channels[i].channel)
@@ -398,7 +393,6 @@ static int pwm_timer(struct lpc17_40_pwmtimer_s *priv,
}
}
}
#endif
#ifdef CONFIG_LPC17_40_PWM1_CHANNEL1
pcrval |= PWMENA1;
+16 -38
View File
@@ -68,9 +68,6 @@ struct nrf52_pwm_s
uint32_t ch1_pin; /* Channel 2 pin */
uint32_t ch2_pin; /* Channel 3 pin */
uint32_t ch3_pin; /* Channel 4 pin */
#ifndef CONFIG_PWM_MULTICHAN
uint8_t channel; /* Assigned channel */
#endif
/* Sequence 0 */
@@ -148,9 +145,6 @@ struct nrf52_pwm_s g_nrf52_pwm0 =
#ifdef CONFIG_NRF52_PWM0_CH3
.ch3_pin = NRF52_PWM0_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF52_PWM0_CHANNEL
#endif
};
#endif
@@ -173,9 +167,6 @@ struct nrf52_pwm_s g_nrf52_pwm1 =
#ifdef CONFIG_NRF52_PWM1_CH3
.ch3_pin = NRF52_PWM1_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF52_PWM1_CHANNEL
#endif
};
#endif
@@ -198,9 +189,6 @@ struct nrf52_pwm_s g_nrf52_pwm2 =
#ifdef CONFIG_NRF52_PWM2_CH3
.ch3_pin = NRF52_PWM2_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF52_PWM2_CHANNEL
#endif
};
#endif
@@ -223,9 +211,6 @@ struct nrf52_pwm_s g_nrf52_pwm3 =
#ifdef CONFIG_NRF52_PWM3_CH3
.ch3_pin = NRF52_PWM3_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF52_PWM3_CHANNEL
#endif
};
#endif
@@ -568,9 +553,7 @@ static int nrf52_pwm_start(struct pwm_lowerhalf_s *dev,
{
struct nrf52_pwm_s *priv = (struct nrf52_pwm_s *)dev;
int ret = OK;
#ifdef CONFIG_PWM_MULTICHAN
int i = 0;
#endif
int i;
DEBUGASSERT(dev);
@@ -588,29 +571,24 @@ static int nrf52_pwm_start(struct pwm_lowerhalf_s *dev,
}
}
#ifdef CONFIG_PWM_MULTICHAN
for (i = 0; ret == OK && i < CONFIG_PWM_NCHANNELS; i++)
for (i = 0; ret == OK && i < CONFIG_PWM_NCHANNELS; i++)
{
/* Break the loop if all following channels are not configured */
if (info->channels[i].channel == -1)
{
/* Break the loop if all following channels are not configured */
if (info->channels[i].channel == -1)
{
break;
}
/* Set output if channel configured */
if (info->channels[i].channel != 0)
{
ret = nrf52_pwm_duty(priv,
(info->channels[i].channel - 1),
info->channels[i].duty);
}
break;
}
#else
ret = nrf52_pwm_duty(priv, priv->channel, info->duty);
#endif /* CONFIG_PWM_MULTICHAN */
/* Set output if channel configured */
if (info->channels[i].channel != 0)
{
ret = nrf52_pwm_duty(priv,
(info->channels[i].channel - 1),
info->channels[i].duty);
}
}
/* Start sequence 0 */
+15 -34
View File
@@ -68,9 +68,6 @@ struct nrf53_pwm_s
uint32_t ch1_pin; /* Channel 2 pin */
uint32_t ch2_pin; /* Channel 3 pin */
uint32_t ch3_pin; /* Channel 4 pin */
#ifndef CONFIG_PWM_MULTICHAN
uint8_t channel; /* Assigned channel */
#endif
/* Sequence 0 */
@@ -148,9 +145,6 @@ struct nrf53_pwm_s g_nrf53_pwm0 =
#ifdef CONFIG_NRF53_PWM0_CH3
.ch3_pin = NRF53_PWM0_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF53_PWM0_CHANNEL
#endif
};
#endif
@@ -173,9 +167,6 @@ struct nrf53_pwm_s g_nrf53_pwm1 =
#ifdef CONFIG_NRF53_PWM1_CH3
.ch3_pin = NRF53_PWM1_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF53_PWM1_CHANNEL
#endif
};
#endif
@@ -198,9 +189,6 @@ struct nrf53_pwm_s g_nrf53_pwm2 =
#ifdef CONFIG_NRF53_PWM2_CH3
.ch3_pin = NRF53_PWM2_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF53_PWM2_CHANNEL
#endif
};
#endif
@@ -543,9 +531,7 @@ static int nrf53_pwm_start(struct pwm_lowerhalf_s *dev,
{
struct nrf53_pwm_s *priv = (struct nrf53_pwm_s *)dev;
int ret = OK;
#ifdef CONFIG_PWM_MULTICHAN
int i = 0;
#endif
DEBUGASSERT(dev);
@@ -563,29 +549,24 @@ static int nrf53_pwm_start(struct pwm_lowerhalf_s *dev,
}
}
#ifdef CONFIG_PWM_MULTICHAN
for (i = 0; ret == OK && i < CONFIG_PWM_NCHANNELS; i++)
for (i = 0; ret == OK && i < CONFIG_PWM_NCHANNELS; i++)
{
/* Break the loop if all following channels are not configured */
if (info->channels[i].channel == -1)
{
/* Break the loop if all following channels are not configured */
if (info->channels[i].channel == -1)
{
break;
}
/* Set output if channel configured */
if (info->channels[i].channel != 0)
{
ret = nrf53_pwm_duty(priv,
(info->channels[i].channel - 1),
info->channels[i].duty);
}
break;
}
#else
ret = nrf53_pwm_duty(priv, priv->channel, info->duty);
#endif /* CONFIG_PWM_MULTICHAN */
/* Set output if channel configured */
if (info->channels[i].channel != 0)
{
ret = nrf53_pwm_duty(priv,
(info->channels[i].channel - 1),
info->channels[i].duty);
}
}
/* Start sequence 0 */
+5 -4
View File
@@ -556,13 +556,14 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
}
/* Calculate the duty cycle register value.
* info->duty is a 16-bit value (0..65535). To avoid 64-bit math we
* can split the 32-bit period into high and low 16-bit parts
* info->channels[0].duty is a 16-bit value (0..65535).
* To avoid 64-bit math we can split the 32-bit period into high
* and low 16-bit parts
*/
hi = period >> 16;
lo = period & 0xffff;
duty16 = (uint32_t)info->duty;
duty16 = (uint32_t)info->channels[0].duty;
duty = hi * duty16;
@@ -578,7 +579,7 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
/* Save the frequency and duty cycle settings */
priv->frequency = info->frequency;
priv->duty = info->duty;
priv->duty = info->channels[0].duty;
/* Stop the timer */
+5 -4
View File
@@ -360,10 +360,11 @@ static int pwm_timer(struct s32k1xx_pwmtimer_s *priv,
DEBUGASSERT(priv != NULL && info != NULL);
pwminfo("FTM%d channel: %d frequency: %" PRId32 " duty: %08" PRIx32 "\n",
priv->tpmid, priv->channel, info->frequency, info->duty);
priv->tpmid, priv->channel, info->frequency,
info->channels[0].duty);
DEBUGASSERT(info->frequency > 0 && info->duty > 0 &&
info->duty < uitoub16(100));
DEBUGASSERT(info->frequency > 0 && info->channels[0].duty > 0 &&
info->channels[0].duty < uitoub16(100));
/* Calculate optimal values for the timer prescaler and for the timer
* modulo register. If' frequency' is the desired frequency, then
@@ -427,7 +428,7 @@ static int pwm_timer(struct s32k1xx_pwmtimer_s *priv,
* duty cycle = cv / modulo (fractional value)
*/
cv = b16toi(info->duty * modulo + b16HALF);
cv = b16toi(info->channels[0].duty * modulo + b16HALF);
pwminfo("FTM%d PCLK: %" PRId32 " frequency: %" PRId32 " FTMCLK: %" PRId32
" prescaler: %d modulo: %" PRId32 "c0v: %" PRId32 "\n",
+1 -1
View File
@@ -1022,7 +1022,7 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
* to the CTDY (vs. the CTDYUPD) register.
*/
regval = b16toi(info->duty * cprd + b16HALF);
regval = b16toi(info->channels[0].duty * cprd + b16HALF);
if (regval > cprd)
{
/* Rounding up could cause the duty value to exceed CPRD (?) */
-3
View File
@@ -387,7 +387,6 @@ config SAMV7_HAVE_MEDIALB
config SAMV7_PWM
bool
default n
select ARCH_HAVE_PWM_MULTICHAN
select ARCH_HAVE_PWM_OVERWRITE
select ARCH_HAVE_PWM_DEADTIME
@@ -742,7 +741,6 @@ if SAMV7_PWM0
config SAMV7_PWM0_SYNC
bool "PWM0 synchronous channels"
depends on PWM_MULTICHAN
default n
---help---
This option makes the synchronization between channels possible.
@@ -1097,7 +1095,6 @@ if SAMV7_PWM1
config SAMV7_PWM1_SYNC
bool "PWM1 synchronous channels"
depends on PWM_MULTICHAN
default n
---help---
This option makes the synchronization between channels possible.
-18
View File
@@ -963,7 +963,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
const struct pwm_info_s *info)
{
struct sam_pwm_s *priv = (struct sam_pwm_s *)dev;
#ifdef CONFIG_PWM_MULTICHAN
uint32_t regval;
for (int i = 0; i < PWM_NCHANNELS; i++)
@@ -1036,18 +1035,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
pwm_putreg(priv, SAMV7_PWM_ENA, CHID_SEL(1));
pwm_putreg(priv, SAMV7_PWM_SCUC, regval);
}
#else
/* Set the frequency and enable PWM output just for first channel */
pwm_set_freq(dev, priv->channels[0].channel, info->frequency);
#ifdef CONFIG_PWM_DEADTIME
pwm_set_deadtime(dev, priv->channels[0].channel,
info->dead_time_a, info->dead_time_b);
#endif
pwm_set_polarity(dev, priv->channels[0].channel,
info->cpol, info->dcpol);
pwm_set_output(dev, priv->channels[0].channel, info->duty);
#endif
pwm_set_comparison(dev);
@@ -1078,7 +1065,6 @@ static int pwm_stop(struct pwm_lowerhalf_s *dev)
struct sam_pwm_s *priv = (struct sam_pwm_s *)dev;
uint32_t regval;
#ifdef CONFIG_PWM_MULTICHAN
for (int i = 0; i < priv->channels_num; i++)
{
regval = CHID_SEL(1 << priv->channels[i].channel);
@@ -1091,10 +1077,6 @@ static int pwm_stop(struct pwm_lowerhalf_s *dev)
regval &= ~(CHID_SEL(1 << 0) | CHID_SEL(1 << 1) |
CHID_SEL(1 << 2) | CHID_SEL(1 << 3));
pwm_putreg(priv, SAMV7_PWM_SCM, regval);
#else
regval = CHID_SEL(1 << priv->channels[0].channel);
pwm_putreg(priv, SAMV7_PWM_DIS, regval);
#endif /* CONFIG_PWM_MULTICHAN */
return OK;
}
-1
View File
@@ -6034,7 +6034,6 @@ config STM32_PWM_MULTICHAN
bool "PWM Multiple Output Channels"
default n
depends on STM32_PWM
select ARCH_HAVE_PWM_MULTICHAN
---help---
Specifies that the PWM driver supports multiple output
channels per timer.
+14 -42
View File
@@ -2321,11 +2321,6 @@ static int pwm_duty_update(struct pwm_lowerhalf_s *dev, uint8_t channel,
pwminfo("TIM%u channel: %u duty: %08" PRIx32 "\n",
priv->timid, channel, duty);
#ifndef CONFIG_PWM_MULTICHAN
DEBUGASSERT(channel == priv->channels[0].channel);
DEBUGASSERT(duty >= 0 && duty < uitoub16(100));
#endif
/* Get the reload values */
reload = pwm_arr_get(dev);
@@ -3372,13 +3367,13 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
pwminfo("TIM%u channel: %u frequency: %" PRIx32 " duty: %08" PRIx32
" count: %" PRIx32 "\n",
priv->timid, priv->channels[0].channel, info->frequency,
info->duty, info->count);
info->channels[0].duty, info->channels[0].count);
DEBUGASSERT(info->frequency > 0);
/* Channel specific setup */
duty = info->duty;
duty = info->channels[0].duty;
channel = priv->channels[0].channel;
/* Disable all interrupts and DMA requests, clear all pending status */
@@ -3407,7 +3402,7 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* assured us that the count value is within range).
*/
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Save the remaining count and the number of counts that will have
* elapsed on the first interrupt.
@@ -3418,7 +3413,7 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* value.
*/
priv->prev = pwm_pulsecount(info->count);
priv->prev = pwm_pulsecount(info->channels[0].count);
pwm_rcr_update(dev, priv->prev - 1);
/* Generate an update event to reload the prescaler. This should
@@ -3431,8 +3426,8 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* update event.
*/
priv->count = info->count;
priv->curr = pwm_pulsecount(info->count - priv->prev);
priv->count = info->channels[0].count;
priv->curr = pwm_pulsecount(info->channels[0].count - priv->prev);
pwm_rcr_update(dev, priv->curr - 1);
}
@@ -3461,12 +3456,13 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
goto errout;
}
/* Setup update interrupt. If info->count is > 0, then we can be
* assured that pwm_pulsecount_start() has already verified: (1) that this
* is an advanced timer, and that (2) the repetition count is within range.
/* Setup update interrupt. If info->channels[0].count is > 0, then we can
* be assured that pwm_pulsecount_start() has already verified: (1) that
* this is an advanced timer, and that (2) the repetition count is within
* range.
*/
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Clear all pending interrupts and enable the update interrupt. */
@@ -3620,16 +3616,11 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
uint8_t channel = 0;
ub16_t duty = 0;
int ret = OK;
#ifdef CONFIG_PWM_MULTICHAN
int i = 0;
int j = 0;
#endif
#ifdef CONFIG_PWM_MULTICHAN
for (i = 0; i < CONFIG_PWM_NCHANNELS; i++)
#endif
{
#ifdef CONFIG_PWM_MULTICHAN
/* Break the loop if all following channels are not configured */
if (info->channels[i].channel == -1)
@@ -3662,10 +3653,6 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
ret = -EINVAL;
goto errout;
}
#else
duty = info->duty;
channel = priv->channels[0].channel;
#endif
/* Update duty cycle */
@@ -3674,9 +3661,7 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
{
goto errout;
}
#ifdef CONFIG_PWM_MULTICHAN
}
#endif
}
errout:
@@ -3707,19 +3692,10 @@ static int pwm_timer(struct pwm_lowerhalf_s *dev,
DEBUGASSERT(priv != NULL && info != NULL);
#if defined(CONFIG_PWM_MULTICHAN)
pwminfo("TIM%u frequency: %" PRIu32 "\n",
priv->timid, info->frequency);
#else
pwminfo("TIM%u channel: %u frequency: %" PRIu32 " duty: %08" PRIx32 "\n",
priv->timid, priv->channels[0].channel,
info->frequency, info->duty);
#endif
DEBUGASSERT(info->frequency > 0);
#ifndef CONFIG_PWM_MULTICHAN
DEBUGASSERT(info->duty >= 0 && info->duty < uitoub16(100));
#endif
/* TODO: what if we have pwm running and we want disable some channels ? */
@@ -4336,14 +4312,14 @@ static int pwm_start_pulsecount(struct pwm_lowerhalf_s *dev,
/* Generate an indefinite number of pulses */
if (info->count == 0)
if (info->channels[0].count == 0)
{
return pwm_start(dev, info);
}
/* Check if a pulsecount has been selected */
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Only the advanced timers (TIM1,8 can support the pulse counting)
* REVISIT: verify if TIMTYPE_COUNTUP16_N works with it
@@ -4352,7 +4328,7 @@ static int pwm_start_pulsecount(struct pwm_lowerhalf_s *dev,
if (priv->timtype != TIMTYPE_ADVANCED)
{
pwmerr("ERROR: TIM%u cannot support pulse count: %" PRIx32 "\n",
priv->timid, info->count);
priv->timid, info->channels[0].count);
return -EPERM;
}
}
@@ -4377,7 +4353,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
if (info->frequency == priv->frequency)
{
#ifdef CONFIG_PWM_MULTICHAN
int i;
for (i = 0; ret == OK && i < CONFIG_PWM_NCHANNELS; i++)
@@ -4397,9 +4372,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
info->channels[i].duty);
}
}
#else
ret = pwm_duty_update(dev, priv->channels[0].channel, info->duty);
#endif /* CONFIG_PWM_MULTICHAN */
}
else
{
+1 -1
View File
@@ -356,7 +356,7 @@
#endif
#define PWM_TIM17_NCHANNELS PWM_TIM17_CHANNEL1
#else /* !CONFIG_PWM_MULTICHAN */
#else /* !CONFIG_STM32_PWM_MULTICHAN */
/* For each timer that is enabled for PWM usage, we need the following
* additional configuration settings:
-1
View File
@@ -3126,7 +3126,6 @@ config STM32F0L0G0_PWM_MULTICHAN
bool "PWM Multiple Output Channels"
default n
depends on STM32F0L0G0_PWM
select ARCH_HAVE_PWM_MULTICHAN
---help---
Specifies that the PWM driver supports multiple output channels per timer.
+16 -43
View File
@@ -852,9 +852,7 @@ static int stm32pwm_output_configure(struct stm32_pwmtimer_s *priv,
static int stm32pwm_timer(struct stm32_pwmtimer_s *priv,
const struct pwm_info_s *info)
{
#ifdef CONFIG_PWM_MULTICHAN
int i;
#endif
/* Calculated values */
@@ -884,24 +882,17 @@ static int stm32pwm_timer(struct stm32_pwmtimer_s *priv,
ccmr2 = stm32pwm_getreg(priv, STM32_GTIM_CCMR2_OFFSET);
#endif
#if defined(CONFIG_PWM_MULTICHAN)
pwminfo("TIM%u frequency: %" PRIu32 "\n",
priv->timid, info->frequency);
#elif defined(CONFIG_PWM_PULSECOUNT)
#ifdef CONFIG_PWM_PULSECOUNT
pwminfo("TIM%u channel: %u frequency: %" PRIu32 " duty: %08" PRIx32
" count: %u\n",
priv->timid, priv->channels[0].channel, info->frequency,
info->duty, info->count);
info->channels[0].duty, info->channels[0].count);
#else
pwminfo("TIM%u channel: %u frequency: %" PRIu32 " duty: %08" PRIx32 "\n",
priv->timid, priv->channels[0].channel, info->frequency,
info->duty);
pwminfo("TIM%u frequency: %" PRIu32 "\n",
priv->timid, info->frequency);
#endif
DEBUGASSERT(info->frequency > 0);
#ifndef CONFIG_PWM_MULTICHAN
DEBUGASSERT(info->duty >= 0 && info->duty < uitoub16(100));
#endif
/* Disable all interrupts and DMA requests, clear all pending status */
@@ -1080,7 +1071,7 @@ static int stm32pwm_timer(struct stm32_pwmtimer_s *priv,
*/
#ifdef CONFIG_PWM_PULSECOUNT
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Save the remaining count and the number of counts that will have
* elapsed on the first interrupt.
@@ -1091,7 +1082,7 @@ static int stm32pwm_timer(struct stm32_pwmtimer_s *priv,
* value.
*/
priv->prev = stm32pwm_pulsecount(info->count);
priv->prev = stm32pwm_pulsecount(info->channels[0].count);
stm32pwm_putreg(priv, STM32_ATIM_RCR_OFFSET, priv->prev - 1);
/* Generate an update event to reload the prescaler. This should
@@ -1104,8 +1095,9 @@ static int stm32pwm_timer(struct stm32_pwmtimer_s *priv,
* update event.
*/
priv->count = info->count;
priv->curr = stm32pwm_pulsecount(info->count - priv->prev);
priv->count = info->channels[0].count;
priv->curr = stm32pwm_pulsecount(info->channels[0].count
- priv->prev);
stm32pwm_putreg(priv, STM32_ATIM_RCR_OFFSET, priv->curr - 1);
}
@@ -1138,20 +1130,15 @@ static int stm32pwm_timer(struct stm32_pwmtimer_s *priv,
ocmode2 = 0;
#endif
#ifdef CONFIG_PWM_MULTICHAN
for (i = 0; i < CONFIG_PWM_NCHANNELS; i++)
#endif
{
ub16_t duty;
uint32_t chanmode;
bool ocmbit = false;
uint8_t channel;
#ifdef CONFIG_PWM_MULTICHAN
int j;
#endif
enum stm32_chanmode_e mode;
#ifdef CONFIG_PWM_MULTICHAN
/* Break the loop if all following channels are not configured */
if (info->channels[i].channel == -1)
@@ -1185,11 +1172,6 @@ static int stm32pwm_timer(struct stm32_pwmtimer_s *priv,
pwmerr("ERROR: No such channel: %u\n", channel);
return -EINVAL;
}
#else
duty = info->duty;
channel = priv->channels[0].channel;
mode = priv->channels[0].mode;
#endif
/* Duty cycle:
*
@@ -1399,13 +1381,14 @@ static int stm32pwm_timer(struct stm32_pwmtimer_s *priv,
cr1 |= GTIM_CR1_ARPE;
stm32pwm_putreg(priv, STM32_GTIM_CR1_OFFSET, cr1);
/* Setup update interrupt. If info->count is > 0, then we can be
* assured that stm32pwm_start() has already verified: (1) that this is an
* advanced timer, and that (2) the repetition count is within range.
/* Setup update interrupt. If info->channels[0].count is > 0, then we can
* be assured that stm32pwm_start() has already verified: (1) that this
* is an advanced timer, and that (2) the repetition count is within
* range.
*/
#ifdef CONFIG_PWM_PULSECOUNT
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Clear all pending interrupts and enable the update interrupt. */
@@ -1468,11 +1451,6 @@ static int stm32pwm_update_duty(struct stm32_pwmtimer_s *priv,
pwminfo("TIM%u channel: %u duty: %08" PRIx32 "\n",
priv->timid, channel, duty);
#ifndef CONFIG_PWM_MULTICHAN
DEBUGASSERT(channel == priv->channels[0].channel);
DEBUGASSERT(duty >= 0 && duty < uitoub16(100));
#endif
/* Get the reload values */
reload = stm32pwm_getreg(priv, STM32_GTIM_ARR_OFFSET);
@@ -1913,14 +1891,14 @@ static int stm32pwm_start(struct pwm_lowerhalf_s *dev,
/* Check if a pulsecount has been selected */
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Only the advanced timers (TIM1,8 can support the pulse counting) */
if (priv->timtype != TIMTYPE_ADVANCED)
{
pwmerr("ERROR: TIM%u cannot support pulse count: %u\n",
priv->timid, info->count);
priv->timid, info->channels[0].count);
return -EPERM;
}
}
@@ -1945,7 +1923,6 @@ static int stm32pwm_start(struct pwm_lowerhalf_s *dev,
if (info->frequency == priv->frequency)
{
#ifdef CONFIG_PWM_MULTICHAN
int i;
for (i = 0; ret == OK && i < CONFIG_PWM_NCHANNELS; i++)
@@ -1965,10 +1942,6 @@ static int stm32pwm_start(struct pwm_lowerhalf_s *dev,
info->channels[i].duty);
}
}
#else
ret = stm32pwm_update_duty(priv, priv->channels[0].channel,
info->duty);
#endif
}
else
#endif
-153
View File
@@ -105,8 +105,6 @@
defined(CONFIG_STM32F0L0G0_TIM15_PWM) || defined(CONFIG_STM32F0L0G0_TIM16_PWM) || \
defined(CONFIG_STM32F0L0G0_TIM17_PWM)
#ifdef CONFIG_PWM_MULTICHAN
#ifdef CONFIG_STM32F0L0G0_TIM1_CHANNEL1
# ifdef CONFIG_STM32F0L0G0_TIM1_CH1OUT
# define PWM_TIM1_CH1CFG GPIO_TIM1_CH1OUT
@@ -337,157 +335,6 @@
MAX(PWM_TIM16_NCHANNELS, \
PWM_TIM17_NCHANNELS))))))
#else /* !CONFIG_PWM_MULTICHAN */
/* For each timer that is enabled for PWM usage, we need the following
* additional configuration settings:
*
* CONFIG_STM32F0L0G0_TIMx_CHANNEL - Specifies the timer output channel
* {1,..,4} PWM_TIMx_CHn - One of the values defined in
* chip/stm32*_pinmap.h. In the case where there are multiple pin
* selections, the correct setting must be provided in the arch/board/board.h
* file.
*
* NOTE: The STM32 timers are each capable of generating different signals on
* each of the four channels with different duty cycles. That capability is
* not supported by this driver: Only one output channel per timer.
*/
#ifdef CONFIG_STM32F0L0G0_TIM1_PWM
# if !defined(CONFIG_STM32F0L0G0_TIM1_CHANNEL)
# error "CONFIG_STM32F0L0G0_TIM1_CHANNEL must be provided"
# elif CONFIG_STM32F0L0G0_TIM1_CHANNEL == 1
# define CONFIG_STM32F0L0G0_TIM1_CHANNEL1 1
# define CONFIG_STM32F0L0G0_TIM1_CH1MODE CONFIG_STM32F0L0G0_TIM1_CHMODE
# define PWM_TIM1_CH1CFG GPIO_TIM1_CH1OUT
# define PWM_TIM1_CH1NCFG 0
# elif CONFIG_STM32F0L0G0_TIM1_CHANNEL == 2
# define CONFIG_STM32F0L0G0_TIM1_CHANNEL2 1
# define CONFIG_STM32F0L0G0_TIM1_CH2MODE CONFIG_STM32F0L0G0_TIM1_CHMODE
# define PWM_TIM1_CH2CFG GPIO_TIM1_CH2OUT
# define PWM_TIM1_CH2NCFG 0
# elif CONFIG_STM32F0L0G0_TIM1_CHANNEL == 3
# define CONFIG_STM32F0L0G0_TIM1_CHANNEL3 1
# define CONFIG_STM32F0L0G0_TIM1_CH3MODE CONFIG_STM32F0L0G0_TIM1_CHMODE
# define PWM_TIM1_CH3CFG GPIO_TIM1_CH3OUT
# define PWM_TIM1_CH3NCFG 0
# elif CONFIG_STM32F0L0G0_TIM1_CHANNEL == 4
# define CONFIG_STM32F0L0G0_TIM1_CHANNEL4 1
# define CONFIG_STM32F0L0G0_TIM1_CH4MODE CONFIG_STM32F0L0G0_TIM1_CHMODE
# define PWM_TIM1_CH4CFG GPIO_TIM1_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32F0L0G0_TIM1_CHANNEL"
# endif
#endif
#ifdef CONFIG_STM32F0L0G0_TIM2_PWM
# if !defined(CONFIG_STM32F0L0G0_TIM2_CHANNEL)
# error "CONFIG_STM32F0L0G0_TIM2_CHANNEL must be provided"
# elif CONFIG_STM32F0L0G0_TIM2_CHANNEL == 1
# define CONFIG_STM32F0L0G0_TIM2_CHANNEL1 1
# define CONFIG_STM32F0L0G0_TIM2_CH1MODE CONFIG_STM32F0L0G0_TIM2_CHMODE
# define PWM_TIM2_CH1CFG GPIO_TIM2_CH1OUT
# elif CONFIG_STM32F0L0G0_TIM2_CHANNEL == 2
# define CONFIG_STM32F0L0G0_TIM2_CHANNEL2 1
# define CONFIG_STM32F0L0G0_TIM2_CH2MODE CONFIG_STM32F0L0G0_TIM2_CHMODE
# define PWM_TIM2_CH2CFG GPIO_TIM2_CH2OUT
# elif CONFIG_STM32F0L0G0_TIM2_CHANNEL == 3
# define CONFIG_STM32F0L0G0_TIM2_CHANNEL3 1
# define CONFIG_STM32F0L0G0_TIM2_CH3MODE CONFIG_STM32F0L0G0_TIM2_CHMODE
# define PWM_TIM2_CH3CFG GPIO_TIM2_CH3OUT
# elif CONFIG_STM32F0L0G0_TIM2_CHANNEL == 4
# define CONFIG_STM32F0L0G0_TIM2_CHANNEL4 1
# define CONFIG_STM32F0L0G0_TIM2_CH4MODE CONFIG_STM32F0L0G0_TIM2_CHMODE
# define PWM_TIM2_CH4CFG GPIO_TIM2_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32F0L0G0_TIM2_CHANNEL"
# endif
#endif
#ifdef CONFIG_STM32F0L0G0_TIM3_PWM
# if !defined(CONFIG_STM32F0L0G0_TIM3_CHANNEL)
# error "CONFIG_STM32F0L0G0_TIM3_CHANNEL must be provided"
# elif CONFIG_STM32F0L0G0_TIM3_CHANNEL == 1
# define CONFIG_STM32F0L0G0_TIM3_CHANNEL1 1
# define CONFIG_STM32F0L0G0_TIM3_CH1MODE CONFIG_STM32F0L0G0_TIM3_CHMODE
# define PWM_TIM3_CH1CFG GPIO_TIM3_CH1OUT
# elif CONFIG_STM32F0L0G0_TIM3_CHANNEL == 2
# define CONFIG_STM32F0L0G0_TIM3_CHANNEL2 1
# define CONFIG_STM32F0L0G0_TIM3_CH2MODE CONFIG_STM32F0L0G0_TIM3_CHMODE
# define PWM_TIM3_CH2CFG GPIO_TIM3_CH2OUT
# elif CONFIG_STM32F0L0G0_TIM3_CHANNEL == 3
# define CONFIG_STM32F0L0G0_TIM3_CHANNEL3 1
# define CONFIG_STM32F0L0G0_TIM3_CH3MODE CONFIG_STM32F0L0G0_TIM3_CHMODE
# define PWM_TIM3_CH3CFG GPIO_TIM3_CH3OUT
# elif CONFIG_STM32F0L0G0_TIM3_CHANNEL == 4
# define CONFIG_STM32F0L0G0_TIM3_CHANNEL4 1
# define CONFIG_STM32F0L0G0_TIM3_CH4MODE CONFIG_STM32F0L0G0_TIM3_CHMODE
# define PWM_TIM3_CH4CFG GPIO_TIM3_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32F0L0G0_TIM3_CHANNEL"
# endif
#endif
#ifdef CONFIG_STM32F0L0G0_TIM14_PWM
# if !defined(CONFIG_STM32F0L0G0_TIM14_CHANNEL)
# error "CONFIG_STM32F0L0G0_TIM14_CHANNEL must be provided"
# elif CONFIG_STM32F0L0G0_TIM14_CHANNEL == 1
# define CONFIG_STM32F0L0G0_TIM14_CHANNEL1 1
# define CONFIG_STM32F0L0G0_TIM14_CH1MODE CONFIG_STM32F0L0G0_TIM14_CHMODE
# define PWM_TIM14_CH1CFG GPIO_TIM14_CH1OUT
# define PWM_TIM14_CH1NCFG 0
# else
# error "Unsupported value of CONFIG_STM32F0L0G0_TIM14_CHANNEL"
# endif
#endif
#ifdef CONFIG_STM32F0L0G0_TIM15_PWM
# if !defined(CONFIG_STM32F0L0G0_TIM15_CHANNEL)
# error "CONFIG_STM32F0L0G0_TIM15_CHANNEL must be provided"
# elif CONFIG_STM32F0L0G0_TIM15_CHANNEL == 1
# define CONFIG_STM32F0L0G0_TIM15_CHANNEL1 1
# define CONFIG_STM32F0L0G0_TIM15_CH1MODE CONFIG_STM32F0L0G0_TIM15_CHMODE
# define PWM_TIM15_CH1CFG GPIO_TIM15_CH1OUT
# define PWM_TIM15_CH1NCFG 0
# elif CONFIG_STM32F0L0G0_TIM15_CHANNEL == 2
# define CONFIG_STM32F0L0G0_TIM15_CHANNEL2 1
# define CONFIG_STM32F0L0G0_TIM15_CH2MODE CONFIG_STM32F0L0G0_TIM15_CHMODE
# define PWM_TIM15_CH2CFG GPIO_TIM15_CH2OUT
# else
# error "Unsupported value of CONFIG_STM32F0L0G0_TIM15_CHANNEL"
# endif
#endif
#ifdef CONFIG_STM32F0L0G0_TIM16_PWM
# if !defined(CONFIG_STM32F0L0G0_TIM16_CHANNEL)
# error "CONFIG_STM32F0L0G0_TIM16_CHANNEL must be provided"
# elif CONFIG_STM32F0L0G0_TIM16_CHANNEL == 1
# define CONFIG_STM32F0L0G0_TIM16_CHANNEL1 1
# define CONFIG_STM32F0L0G0_TIM16_CH1MODE CONFIG_STM32F0L0G0_TIM16_CHMODE
# define PWM_TIM16_CH1CFG GPIO_TIM16_CH1OUT
# define PWM_TIM16_CH1NCFG 0
# else
# error "Unsupported value of CONFIG_STM32F0L0G0_TIM16_CHANNEL"
# endif
#endif
#ifdef CONFIG_STM32F0L0G0_TIM17_PWM
# if !defined(CONFIG_STM32F0L0G0_TIM17_CHANNEL)
# error "CONFIG_STM32F0L0G0_TIM17_CHANNEL must be provided"
# elif CONFIG_STM32F0L0G0_TIM17_CHANNEL == 1
# define CONFIG_STM32F0L0G0_TIM17_CHANNEL1 1
# define CONFIG_STM32F0L0G0_TIM17_CH1MODE CONFIG_STM32F0L0G0_TIM17_CHMODE
# define PWM_TIM17_CH1CFG GPIO_TIM17_CH1OUT
# define PWM_TIM17_CH1NCFG 0
# else
# error "Unsupported value of CONFIG_STM32F0L0G0_TIM17_CHANNEL"
# endif
#endif
#define PWM_NCHANNELS 1
#endif
/* Complementary outputs support */
#if defined(CONFIG_STM32F0L0G0_TIM1_CH1NOUT) || defined(CONFIG_STM32F0L0G0_TIM1_CH2NOUT) || \
-1
View File
@@ -4658,7 +4658,6 @@ config STM32F7_PWM_MULTICHAN
bool "PWM Multiple Output Channels"
default n
depends on STM32F7_PWM
select ARCH_HAVE_PWM_MULTICHAN
---help---
Specifies that the PWM driver supports multiple output
channels per timer.
+14 -42
View File
@@ -1926,11 +1926,6 @@ static int pwm_duty_update(struct pwm_lowerhalf_s *dev, uint8_t channel,
pwminfo("TIM%u channel: %u duty: %08" PRIx32 "\n",
priv->timid, channel, duty);
#ifndef CONFIG_PWM_MULTICHAN
DEBUGASSERT(channel == priv->channels[0].channel);
DEBUGASSERT(duty >= 0 && duty < uitoub16(100));
#endif
/* Get the reload values */
reload = pwm_arr_get(dev);
@@ -2948,13 +2943,13 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
pwminfo("TIM%u channel: %u frequency: %" PRIx32 " duty: %08" PRIx32
" count: %" PRIx32 "\n",
priv->timid, priv->channels[0].channel, info->frequency,
info->duty, info->count);
info->channels[0].duty, info->channels[0].count);
DEBUGASSERT(info->frequency > 0);
/* Channel specific setup */
duty = info->duty;
duty = info->channels[0].duty;
channel = priv->channels[0].channel;
/* Disable all interrupts and DMA requests, clear all pending status */
@@ -2983,7 +2978,7 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* assured us that the count value is within range).
*/
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Save the remaining count and the number of counts that will have
* elapsed on the first interrupt.
@@ -2994,7 +2989,7 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* value.
*/
priv->prev = pwm_pulsecount(info->count);
priv->prev = pwm_pulsecount(info->channels[0].count);
pwm_rcr_update(dev, priv->prev - 1);
/* Generate an update event to reload the prescaler. This should
@@ -3007,8 +3002,8 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* update event.
*/
priv->count = info->count;
priv->curr = pwm_pulsecount(info->count - priv->prev);
priv->count = info->channels[0].count;
priv->curr = pwm_pulsecount(info->channels[0].count - priv->prev);
pwm_rcr_update(dev, priv->curr - 1);
}
@@ -3037,12 +3032,13 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
goto errout;
}
/* Setup update interrupt. If info->count is > 0, then we can be
* assured that pwm_pulsecount_start() has already verified: (1) that this
* is an advanced timer, and that (2) the repetition count is within range.
/* Setup update interrupt. If info->channels[0].count is > 0, then we can
* be assured that pwm_pulsecount_start() has already verified: (1) that
* this is an advanced timer, and that (2) the repetition count is within
* range.
*/
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Clear all pending interrupts and enable the update interrupt. */
@@ -3194,16 +3190,11 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
uint8_t channel = 0;
ub16_t duty = 0;
int ret = OK;
#ifdef CONFIG_PWM_MULTICHAN
int i = 0;
int j = 0;
#endif
#ifdef CONFIG_PWM_MULTICHAN
for (i = 0; i < CONFIG_PWM_NCHANNELS; i++)
#endif
{
#ifdef CONFIG_PWM_MULTICHAN
/* Break the loop if all following channels are not configured */
if (info->channels[i].channel == -1)
@@ -3236,10 +3227,6 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
ret = -EINVAL;
goto errout;
}
#else
duty = info->duty;
channel = priv->channels[0].channel;
#endif
/* Update duty cycle */
@@ -3248,9 +3235,7 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
{
goto errout;
}
#ifdef CONFIG_PWM_MULTICHAN
}
#endif
}
errout:
@@ -3281,19 +3266,10 @@ static int pwm_timer(struct pwm_lowerhalf_s *dev,
DEBUGASSERT(priv != NULL && info != NULL);
#if defined(CONFIG_PWM_MULTICHAN)
pwminfo("TIM%u frequency: %" PRIu32 "\n",
priv->timid, info->frequency);
#else
pwminfo("TIM%u channel: %u frequency: %" PRIu32 " duty: %08" PRIx32 "\n",
priv->timid, priv->channels[0].channel,
info->frequency, info->duty);
#endif
DEBUGASSERT(info->frequency > 0);
#ifndef CONFIG_PWM_MULTICHAN
DEBUGASSERT(info->duty >= 0 && info->duty < uitoub16(100));
#endif
/* TODO: what if we have pwm running and we want disable some channels ? */
@@ -3882,21 +3858,21 @@ static int pwm_start_pulsecount(struct pwm_lowerhalf_s *dev,
/* Generate an indefinite number of pulses */
if (info->count == 0)
if (info->channels[0].count == 0)
{
return pwm_start(dev, info);
}
/* Check if a pulsecount has been selected */
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Only the advanced timers (TIM1,8 can support the pulse counting) */
if (priv->timtype != TIMTYPE_ADVANCED)
{
pwmerr("ERROR: TIM%u cannot support pulse count: %" PRIx32 "\n",
priv->timid, info->count);
priv->timid, info->channels[0].count);
return -EPERM;
}
}
@@ -3921,7 +3897,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
if (info->frequency == priv->frequency)
{
#ifdef CONFIG_PWM_MULTICHAN
int i;
for (i = 0; ret == OK && i < CONFIG_PWM_NCHANNELS; i++)
@@ -3941,9 +3916,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
info->channels[i].duty);
}
}
#else
ret = pwm_duty_update(dev, priv->channels[0].channel, info->duty);
#endif /* CONFIG_PWM_MULTICHAN */
}
else
{
+1 -1
View File
@@ -321,7 +321,7 @@
#endif
#define PWM_TIM14_NCHANNELS (PWM_TIM14_CHANNEL1)
#else /* !CONFIG_PWM_MULTICHAN */
#else /* !CONFIG_STM32F7_PWM_MULTICHAN */
/* For each timer that is enabled for PWM usage, we need the following
* additional configuration settings:
-1
View File
@@ -3373,7 +3373,6 @@ config STM32H5_PWM_MULTICHAN
bool "PWM Multiple Output Channels"
default n
depends on STM32H5_PWM
select ARCH_HAVE_PWM_MULTICHAN
---help---
Specifies that the PWM driver supports multiple output
channels per timer.
+13 -41
View File
@@ -1991,11 +1991,6 @@ static int pwm_duty_update(struct pwm_lowerhalf_s *dev, uint8_t channel,
pwminfo("TIM%u channel: %u duty: %08" PRIx32 "\n",
priv->timid, channel, duty);
#ifndef CONFIG_PWM_MULTICHAN
DEBUGASSERT(channel == priv->channels[0].channel);
DEBUGASSERT(duty >= 0 && duty < uitoub16(100));
#endif
/* Get the reload values */
reload = pwm_arr_get(dev);
@@ -3043,13 +3038,13 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
pwminfo("TIM%u channel: %u frequency: %u duty: %08x count: %u\n",
priv->timid, priv->channels[0].channel, info->frequency,
info->duty, info->count);
info->channels[0].duty, info->channels[0].count);
DEBUGASSERT(info->frequency > 0);
/* Channel specific setup */
duty = info->duty;
duty = info->channels[0].duty;
channel = priv->channels[0].channel;
mode = priv->channels[0].mode;
@@ -3079,7 +3074,7 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* assured us that the count value is within range).
*/
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Save the remaining count and the number of counts that will have
* elapsed on the first interrupt.
@@ -3090,7 +3085,7 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* value.
*/
priv->prev = pwm_pulsecount(info->count);
priv->prev = pwm_pulsecount(info->channels[0].count);
pwm_putreg(priv, STM32_GTIM_RCR_OFFSET, (uint16_t)priv->prev - 1);
/* Generate an update event to reload the prescaler. This should
@@ -3103,8 +3098,8 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* update event.
*/
priv->count = info->count;
priv->curr = pwm_pulsecount(info->count - priv->prev);
priv->count = info->channels[0].count;
priv->curr = pwm_pulsecount(info->channels[0].count - priv->prev);
pwm_putreg(priv, STM32_GTIM_RCR_OFFSET, (uint16_t)priv->curr - 1);
}
@@ -3133,12 +3128,13 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
goto errout;
}
/* Setup update interrupt. If info->count is > 0, then we can be
* assured that pwm_pulsecount_start() has already verified: (1) that this
* is an advanced timer, and that (2) the repetition count is within range.
/* Setup update interrupt. If info->channels[0].count is > 0, then we can
* be assured that pwm_pulsecount_start() has already verified: (1) that
* this is an advanced timer, and that (2) the repetition count is within
* range.
*/
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Clear all pending interrupts and enable the update interrupt. */
@@ -3292,16 +3288,11 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
uint8_t channel = 0;
ub16_t duty = 0;
int ret = OK;
#ifdef CONFIG_PWM_MULTICHAN
int i = 0;
int j = 0;
#endif
#ifdef CONFIG_PWM_MULTICHAN
for (i = 0; i < CONFIG_PWM_NCHANNELS; i++)
#endif
{
#ifdef CONFIG_PWM_MULTICHAN
/* Break the loop if all following channels are not configured */
if (info->channels[i].channel == -1)
@@ -3334,10 +3325,6 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
ret = -EINVAL;
goto errout;
}
#else
duty = info->duty;
channel = priv->channels[0].channel;
#endif
/* Update duty cycle */
@@ -3346,9 +3333,7 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
{
goto errout;
}
#ifdef CONFIG_PWM_MULTICHAN
}
#endif
}
errout:
@@ -3379,19 +3364,10 @@ static int pwm_timer(struct pwm_lowerhalf_s *dev,
DEBUGASSERT(priv != NULL && info != NULL);
#if defined(CONFIG_PWM_MULTICHAN)
pwminfo("TIM%u frequency: %" PRIu32 "\n",
priv->timid, info->frequency);
#else
pwminfo("TIM%u channel: %u frequency: %" PRIu32 " duty: %08" PRIx32 "\n",
priv->timid, priv->channels[0].channel,
info->frequency, info->duty);
#endif
DEBUGASSERT(info->frequency > 0);
#ifndef CONFIG_PWM_MULTICHAN
DEBUGASSERT(info->duty >= 0 && info->duty < uitoub16(100));
#endif
/* TODO: what if we have pwm running and we want disable some channels ? */
@@ -3976,7 +3952,7 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
/* Check if a pulsecount has been selected */
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Only the advanced timers (TIM1,8 can support the pulse counting)
* REVISIT: verify if TIMTYPE_COUNTUP16_N works with it
@@ -3985,7 +3961,7 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
if (priv->timtype != TIMTYPE_ADVANCED)
{
pwmerr("ERROR: TIM%u cannot support pulse count: %u\n",
priv->timid, info->count);
priv->timid, info->channels[0].count);
return -EPERM;
}
}
@@ -4009,7 +3985,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
if (info->frequency == priv->frequency)
{
#ifdef CONFIG_PWM_MULTICHAN
int i;
for (i = 0; ret == OK && i < CONFIG_PWM_NCHANNELS; i++)
@@ -4029,9 +4004,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
info->channels[i].duty);
}
}
#else
ret = pwm_duty_update(dev, priv->channels[0].channel, info->duty);
#endif /* CONFIG_PWM_MULTICHAN */
}
else
{
+1 -1
View File
@@ -321,7 +321,7 @@
#endif
#define PWM_TIM17_NCHANNELS PWM_TIM17_CHANNEL1
#else /* !CONFIG_PWM_MULTICHAN */
#else /* !CONFIG_STM32H5_PWM_MULTICHAN */
/* For each timer that is enabled for PWM usage, we need the following
* additional configuration settings:
-1
View File
@@ -4312,7 +4312,6 @@ config STM32H7_PWM_MULTICHAN
bool "PWM Multiple Output Channels"
default n
depends on STM32H7_PWM
select ARCH_HAVE_PWM_MULTICHAN
---help---
Specifies that the PWM driver supports multiple output
channels per timer.
+13 -41
View File
@@ -1995,11 +1995,6 @@ static int pwm_duty_update(struct pwm_lowerhalf_s *dev, uint8_t channel,
pwminfo("TIM%u channel: %u duty: %08" PRIx32 "\n",
priv->timid, channel, duty);
#ifndef CONFIG_PWM_MULTICHAN
DEBUGASSERT(channel == priv->channels[0].channel);
DEBUGASSERT(duty >= 0 && duty < uitoub16(100));
#endif
/* Get the reload values */
reload = pwm_arr_get(dev);
@@ -3047,13 +3042,13 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
pwminfo("TIM%u channel: %u frequency: %u duty: %08x count: %u\n",
priv->timid, priv->channels[0].channel, info->frequency,
info->duty, info->count);
info->channels[0].duty, info->channels[0].count);
DEBUGASSERT(info->frequency > 0);
/* Channel specific setup */
duty = info->duty;
duty = info->channels[0].duty;
channel = priv->channels[0].channel;
mode = priv->channels[0].mode;
@@ -3083,7 +3078,7 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* assured us that the count value is within range).
*/
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Save the remaining count and the number of counts that will have
* elapsed on the first interrupt.
@@ -3094,7 +3089,7 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* value.
*/
priv->prev = pwm_pulsecount(info->count);
priv->prev = pwm_pulsecount(info->channels[0].count);
pwm_putreg(priv, STM32_GTIM_RCR_OFFSET, (uint16_t)priv->prev - 1);
/* Generate an update event to reload the prescaler. This should
@@ -3107,8 +3102,8 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* update event.
*/
priv->count = info->count;
priv->curr = pwm_pulsecount(info->count - priv->prev);
priv->count = info->channels[0].count;
priv->curr = pwm_pulsecount(info->channels[0].count - priv->prev);
pwm_putreg(priv, STM32_GTIM_RCR_OFFSET, (uint16_t)priv->curr - 1);
}
@@ -3137,12 +3132,13 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
goto errout;
}
/* Setup update interrupt. If info->count is > 0, then we can be
* assured that pwm_pulsecount_start() has already verified: (1) that this
* is an advanced timer, and that (2) the repetition count is within range.
/* Setup update interrupt. If info->channels[0].count is > 0, then we can
* be assured that pwm_pulsecount_start() has already verified: (1) that
* this is an advanced timer, and that (2) the repetition count is within
* range.
*/
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Clear all pending interrupts and enable the update interrupt. */
@@ -3296,16 +3292,11 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
uint8_t channel = 0;
ub16_t duty = 0;
int ret = OK;
#ifdef CONFIG_PWM_MULTICHAN
int i = 0;
int j = 0;
#endif
#ifdef CONFIG_PWM_MULTICHAN
for (i = 0; i < CONFIG_PWM_NCHANNELS; i++)
#endif
{
#ifdef CONFIG_PWM_MULTICHAN
/* Break the loop if all following channels are not configured */
if (info->channels[i].channel == -1)
@@ -3338,10 +3329,6 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
ret = -EINVAL;
goto errout;
}
#else
duty = info->duty;
channel = priv->channels[0].channel;
#endif
/* Update duty cycle */
@@ -3350,9 +3337,7 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
{
goto errout;
}
#ifdef CONFIG_PWM_MULTICHAN
}
#endif
}
errout:
@@ -3383,19 +3368,10 @@ static int pwm_timer(struct pwm_lowerhalf_s *dev,
DEBUGASSERT(priv != NULL && info != NULL);
#if defined(CONFIG_PWM_MULTICHAN)
pwminfo("TIM%u frequency: %" PRIu32 "\n",
priv->timid, info->frequency);
#else
pwminfo("TIM%u channel: %u frequency: %" PRIu32 " duty: %08" PRIx32 "\n",
priv->timid, priv->channels[0].channel,
info->frequency, info->duty);
#endif
DEBUGASSERT(info->frequency > 0);
#ifndef CONFIG_PWM_MULTICHAN
DEBUGASSERT(info->duty >= 0 && info->duty < uitoub16(100));
#endif
/* TODO: what if we have pwm running and we want disable some channels ? */
@@ -3980,7 +3956,7 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
/* Check if a pulsecount has been selected */
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Only the advanced timers (TIM1,8 can support the pulse counting)
* REVISIT: verify if TIMTYPE_COUNTUP16_N works with it
@@ -3989,7 +3965,7 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
if (priv->timtype != TIMTYPE_ADVANCED)
{
pwmerr("ERROR: TIM%u cannot support pulse count: %u\n",
priv->timid, info->count);
priv->timid, info->channels[0].count);
return -EPERM;
}
}
@@ -4013,7 +3989,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
if (info->frequency == priv->frequency)
{
#ifdef CONFIG_PWM_MULTICHAN
int i;
for (i = 0; ret == OK && i < CONFIG_PWM_NCHANNELS; i++)
@@ -4033,9 +4008,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
info->channels[i].duty);
}
}
#else
ret = pwm_duty_update(dev, priv->channels[0].channel, info->duty);
#endif /* CONFIG_PWM_MULTICHAN */
}
else
{
+1 -1
View File
@@ -321,7 +321,7 @@
#endif
#define PWM_TIM17_NCHANNELS PWM_TIM17_CHANNEL1
#else /* !CONFIG_PWM_MULTICHAN */
#else /* !CONFIG_STM32H7_PWM_MULTICHAN */
/* For each timer that is enabled for PWM usage, we need the following
* additional configuration settings:
-1
View File
@@ -3709,7 +3709,6 @@ config STM32L4_PWM_MULTICHAN
bool "PWM Multiple Output Channels"
default n
depends on STM32L4_PWM
select ARCH_HAVE_PWM_MULTICHAN
---help---
Specifies that the PWM driver supports multiple output
channels per timer.
+13 -54
View File
@@ -1806,11 +1806,6 @@ static int pwm_duty_update(struct pwm_lowerhalf_s *dev, uint8_t channel,
pwminfo("TIM%u channel: %u duty: %08" PRIx32 "\n",
priv->timid, channel, duty);
#ifndef CONFIG_STM32L4_PWM_MULTICHAN
DEBUGASSERT(channel == priv->channels[0].channel);
DEBUGASSERT(duty >= 0 && duty < uitoub16(100));
#endif
/* Get the reload values */
reload = pwm_arr_get(dev);
@@ -2945,13 +2940,13 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
pwminfo("TIM%u channel: %u frequency: %u duty: %08x count: %u\n",
priv->timid, priv->channels[0].channel, info->frequency,
info->duty, info->count);
info->channels[0].duty, info->channels[0].count);
DEBUGASSERT(info->frequency > 0);
/* Channel specific setup */
duty = info->duty;
duty = info->channels[0].duty;
channel = priv->channels[0].channel;
/* Disable all interrupts and DMA requests, clear all pending status */
@@ -2980,7 +2975,7 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* assured us that the count value is within range).
*/
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Save the remaining count and the number of counts that will have
* elapsed on the first interrupt.
@@ -2991,7 +2986,7 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* value.
*/
priv->prev = pwm_pulsecount(info->count);
priv->prev = pwm_pulsecount(info->channels[0].count);
pwm_putreg(priv, STM32L4_GTIM_RCR_OFFSET, (uint16_t)priv->prev - 1);
/* Generate an update event to reload the prescaler. This should
@@ -3004,8 +2999,8 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
* update event.
*/
priv->count = info->count;
priv->curr = pwm_pulsecount(info->count - priv->prev);
priv->count = info->channels[0].count;
priv->curr = pwm_pulsecount(info->channels[0].count - priv->prev);
pwm_putreg(priv, STM32L4_GTIM_RCR_OFFSET, (uint16_t)priv->curr - 1);
}
@@ -3034,12 +3029,13 @@ static int pwm_pulsecount_timer(struct pwm_lowerhalf_s *dev,
goto errout;
}
/* Setup update interrupt. If info->count is > 0, then we can be
* assured that pwm_pulsecount_start() has already verified: (1) that this
* is an advanced timer, and that (2) the repetition count is within range.
/* Setup update interrupt. If info->channels[0].count is > 0, then we can
* be assured that pwm_pulsecount_start() has already verified: (1) that
* this is an advanced timer, and that (2) the repetition count is within
* range.
*/
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Clear all pending interrupts and enable the update interrupt. */
@@ -3078,16 +3074,11 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
uint8_t channel = 0;
ub16_t duty = 0;
int ret = OK;
#ifdef CONFIG_STM32L4_PWM_MULTICHAN
int i = 0;
int j = 0;
#endif
#ifdef CONFIG_STM32L4_PWM_MULTICHAN
for (i = 0; i < CONFIG_PWM_NCHANNELS; i++)
#endif
{
#ifdef CONFIG_STM32L4_PWM_MULTICHAN
/* Break the loop if all following channels are not configured */
if (info->channels[i].channel == -1)
@@ -3120,10 +3111,6 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
ret = -EINVAL;
goto errout;
}
#else
duty = info->duty;
channel = priv->channels[0].channel;
#endif
/* Update duty cycle */
@@ -3132,9 +3119,7 @@ static int pwm_duty_channels_update(struct pwm_lowerhalf_s *dev,
{
goto errout;
}
#ifdef CONFIG_STM32L4_PWM_MULTICHAN
}
#endif
}
errout:
@@ -3165,19 +3150,10 @@ static int pwm_timer(struct pwm_lowerhalf_s *dev,
DEBUGASSERT(priv != NULL && info != NULL);
#if defined(CONFIG_STM32L4_PWM_MULTICHAN)
pwminfo("TIM%u frequency: %" PRIu32 "\n",
priv->timid, info->frequency);
#else
pwminfo("TIM%u channel: %u frequency: %" PRIu32 " duty: %08" PRIx32 "\n",
priv->timid, priv->channels[0].channel,
info->frequency, info->duty);
#endif
DEBUGASSERT(info->frequency > 0);
#ifndef CONFIG_STM32L4_PWM_MULTICHAN
DEBUGASSERT(info->duty >= 0 && info->duty < uitoub16(100));
#endif
/* TODO: what if we have pwm running and we want disable some channels ? */
@@ -3272,19 +3248,10 @@ static int pwm_lptimer(struct pwm_lowerhalf_s *dev,
DEBUGASSERT(priv != NULL && info != NULL);
#if defined(CONFIG_STM32L4_PWM_MULTICHAN)
pwminfo("LPTIM%u frequency: %u\n",
priv->timid, info->frequency);
#else
pwminfo("LPTIM%u channel: %u frequency: %u duty: %08x\n",
priv->timid, priv->channels[0].channel,
info->frequency, info->duty);
#endif
DEBUGASSERT(info->frequency > 0);
#ifndef CONFIG_STM32L4_PWM_MULTICHAN
DEBUGASSERT(info->duty >= 0 && info->duty < uitoub16(100));
#endif
/* Enable again, ARR and CMP need to be written while enabled */
@@ -3298,11 +3265,7 @@ static int pwm_lptimer(struct pwm_lowerhalf_s *dev,
goto errout;
}
#ifdef CONFIG_STM32L4_PWM_MULTICHAN
ub16_t duty = info->channels[0].duty;
#else
ub16_t duty = info->duty;
#endif
/* Update duty cycle */
@@ -3883,14 +3846,14 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
/* Check if a pulsecount has been selected */
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Only the advanced timers (TIM1,8 can support the pulse counting) */
if (priv->timtype != TIMTYPE_ADVANCED)
{
pwmerr("ERROR: TIM%u cannot support pulse count: %u\n",
priv->timid, info->count);
priv->timid, info->channels[0].count);
return -EPERM;
}
}
@@ -3915,7 +3878,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
if (info->frequency == priv->frequency)
{
#ifdef CONFIG_STM32L4_PWM_MULTICHAN
int i;
for (i = 0; ret == OK && i < CONFIG_PWM_NCHANNELS; i++)
@@ -3935,9 +3897,6 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
info->channels[i].duty);
}
}
#else
ret = pwm_duty_update(dev, priv->channels[0].channel, info->duty);
#endif /* CONFIG_STM32L4_PWM_MULTICHAN */
}
else
{
-1
View File
@@ -1700,7 +1700,6 @@ config STM32L5_PWM_MULTICHAN
bool "PWM Multiple Output Channels"
default n
depends on STM32L5_TIM1_PWM || STM32L5_TIM2_PWM || STM32L5_TIM3_PWM || STM32L5_TIM4_PWM || STM32L5_TIM5_PWM || STM32L5_TIM8_PWM || STM32L5_TIM15_PWM || STM32L5_TIM16_PWM || STM32L5_TIM17_PWM
select ARCH_HAVE_PWM_MULTICHAN
---help---
Specifies that the PWM driver supports multiple output
channels per timer.
-1
View File
@@ -1998,7 +1998,6 @@ config STM32U5_PWM_MULTICHAN
bool "PWM Multiple Output Channels"
default n
depends on STM32U5_PWM
select ARCH_HAVE_PWM_MULTICHAN
---help---
Specifies that the PWM driver supports multiple output
channels per timer.
+4 -4
View File
@@ -568,8 +568,8 @@ static int tiva_pwm_start(struct pwm_lowerhalf_s *dev,
* Count should be add 1 for the first time
*/
chan->count = info->count;
chan->cur_count = info->count;
chan->count = info->channels[0].count;
chan->cur_count = info->channels[0].count;
if (!chan->inited)
{
@@ -580,7 +580,7 @@ static int tiva_pwm_start(struct pwm_lowerhalf_s *dev,
/* Count 0 means to generate indefinite number of pulses */
if (info->count == 0)
if (info->channels[0].count == 0)
{
pwm_expired(chan->handle);
@@ -636,7 +636,7 @@ static int tiva_pwm_start(struct pwm_lowerhalf_s *dev,
static inline int tiva_pwm_timer(struct tiva_pwm_chan_s *chan,
const struct pwm_info_s *info)
{
uint16_t duty = info->duty;
uint16_t duty = info->channels[0].duty;
uint32_t frequency = info->frequency;
pwminfo("> frequency = %d\n", frequency);
+11 -10
View File
@@ -308,12 +308,12 @@ static int pwm_config(struct tlsr82_pwmtimer_s *priv,
pwminfo("PWM%d invert: %d frequency: %lu duty: %08lx\n",
(int)priv->id, (int)priv->invert, info->frequency,
info->duty);
info->channels[0].duty);
if (info->frequency == 0 || info->duty >= uitoub16(100))
if (info->frequency == 0 || info->channels[0].duty >= uitoub16(100))
{
pwrerr("pwm info is invalid, fre: %lu duty: %08lx\n",
info->frequency, info->duty);
info->frequency, info->channels[0].duty);
return -EINVAL;
}
@@ -331,10 +331,11 @@ static int pwm_config(struct tlsr82_pwmtimer_s *priv,
max = (uint16_t)((g_pwmclk / info->frequency));
cmp = (uint16_t)(((uint64_t)max * (uint64_t)info->duty) >> 16);
cmp = (uint16_t)(((uint64_t)max * (uint64_t)info->channels[0].duty) >> 16);
pwminfo("PWM%d PCLK: %lu freq: %lu duty: %lu max: %u cmp: %u\n",
priv->id, g_pwmclk, info->frequency, info->duty, max, cmp);
priv->id, g_pwmclk, info->frequency, info->channels[0].duty,
max, cmp);
priv->max = max;
priv->cmp = cmp;
@@ -616,25 +617,25 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
/* Check if a pulsecount has been selected */
if (info->count > 0)
if (info->channels[0].count > 0)
{
/* Only the PWM0 support the pulse counting */
if (priv->id != 0)
{
pwmerr("ERROR: PWM%d cannot support pulse count: %lu\n",
priv->id, info->count);
priv->id, info->channels[0].count);
return -EPERM;
}
if (info->count > PWM_MAX_COUNT)
if (info->channels[0].count > PWM_MAX_COUNT)
{
pwmerr("ERROR: PWM0 count out of range, count: %lu, max: %d",
info->count, PWM_MAX_COUNT);
info->channels[0].count, PWM_MAX_COUNT);
return -EINVAL;
}
priv->count = info->count;
priv->count = info->channels[0].count;
}
/* Save the handle */
+7 -7
View File
@@ -851,7 +851,7 @@ static int pwm_compute_config(struct xmc4_pwm_s *priv,
uint32_t crs = 0;
uint32_t f_pwm = info->frequency;
float duty_cycle = (1.0 - b16tof(info->duty));
float duty_cycle = (1.0 - b16tof(info->channels[0].duty));
do
{
@@ -919,7 +919,7 @@ static int pwm_timer(struct xmc4_pwm_s *priv, const struct pwm_info_s *info)
pwm_set_period_match(priv, prs);
pwm_set_compare_match(priv, crs);
pwm_set_passive_level(priv, info->cpol);
pwm_set_passive_level(priv, info->channels[0].cpol);
pwm_shadow_transfert(priv);
}
else
@@ -933,7 +933,7 @@ static int pwm_timer(struct xmc4_pwm_s *priv, const struct pwm_info_s *info)
pwm_set_compare_match(priv, crs);
pwm_set_period_match(priv, prs);
pwm_set_passive_level(priv, info->cpol);
pwm_set_passive_level(priv, info->channels[0].cpol);
pwm_shadow_transfert(priv);
pwm_enable_slice_clock(priv);
@@ -948,7 +948,7 @@ static int pwm_timer(struct xmc4_pwm_s *priv, const struct pwm_info_s *info)
pwm_set_compare_match(priv, crs);
pwm_set_period_match(priv, prs);
pwm_set_passive_level(priv, info->cpol);
pwm_set_passive_level(priv, info->channels[0].cpol);
pwm_shadow_transfert(priv);
pwm_enable_slice_clock(priv);
@@ -956,17 +956,17 @@ static int pwm_timer(struct xmc4_pwm_s *priv, const struct pwm_info_s *info)
}
priv->frequency = info->frequency;
priv->duty = info->duty;
priv->duty = info->channels[0].duty;
}
else
{
/* Frequency doesn't change, update shadow transfer */
pwm_set_compare_match(priv, crs);
pwm_set_passive_level(priv, info->cpol);
pwm_set_passive_level(priv, info->channels[0].cpol);
pwm_shadow_transfert(priv);
priv->duty = info->duty;
priv->duty = info->channels[0].duty;
}
return OK;
-3
View File
@@ -17,7 +17,6 @@ config ARCH_CHIP_IMX93
select ARMV8A_HAVE_GICv3
select ARCH_CORTEX_A55 if !IMX9_BOOTLOADER
select ARCH_CORTEX_A53 if IMX9_BOOTLOADER
select ARCH_HAVE_PWM_MULTICHAN
select ARCH_HAVE_RESET
---help---
EL3/OCRAM is a bad combination for atomic instructions, they don't work.
@@ -67,7 +66,6 @@ endmenu # DMA Allocator Configuration
config IMX9_FLEXIO_PWM
bool
select PWM_MULTICHAN
default n
config IMX9_HAVE_ATF_FIRMWARE
@@ -445,7 +443,6 @@ config IMX9_FLEXIO2_DSHOT_TX_TIMER
config IMX9_TPM_PWM
bool
select PWM_MULTICHAN
default n
config IMX9_TPM1_PWM
-2
View File
@@ -261,7 +261,6 @@ config ARCH_CHIP_MPFS
select ARCH_HAVE_ELF_EXECUTABLE
select ARCH_HAVE_RESET
select ARCH_HAVE_SPI_CS_CONTROL
select ARCH_HAVE_PWM_MULTICHAN
select ARCH_HAVE_S_MODE
select ARCH_RV_CPUID_MAP
select ARCH_HAVE_PERF_EVENTS
@@ -447,7 +446,6 @@ config ARCH_CHIP_RP23XX_RV
select ARCH_RV_ISA_M
select ARCH_RV_ISA_A
select ARCH_RV_ISA_C
select ARCH_HAVE_PWM_MULTICHAN
select ARCH_HAVE_RESET
select ARCH_HAVE_MULTICPU
select ARCH_HAVE_I2CRESET
-1
View File
@@ -18,7 +18,6 @@ config BL602_HAVE_UART0
select ARCH_HAVE_UART0
select UART0_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
select ARCH_HAVE_PWM_MULTICHAN
config BL602_UART0
bool
+1 -1
View File
@@ -387,7 +387,7 @@ static int bl602_pwm_start(struct pwm_lowerhalf_s *dev,
}
#else
bl602_pwm_freq(priv, 0, info->frequency);
bl602_pwm_duty(priv, 0, info->duty);
bl602_pwm_duty(priv, 0, info->channels[0].duty);
pwm_channel_enable(0);
#endif
+10 -11
View File
@@ -1671,7 +1671,6 @@ config ESPRESSIF_LEDC
bool "LEDC (PWM)"
default n
select PWM
select ARCH_HAVE_PWM_MULTICHAN
config ESPRESSIF_SHA_ACCELERATOR
bool "SHA Accelerator"
@@ -3677,8 +3676,8 @@ if ESPRESSIF_LEDC_TIMER0
config ESPRESSIF_LEDC_TIMER0_CHANNELS
int "Number of Timer 0 channels"
default 2 if PWM_MULTICHAN && PWM_NCHANNELS > 1
default 1 if !PWM_MULTICHAN || PWM_NCHANNELS = 1
default 2 if PWM_NCHANNELS > 1
default 1 if PWM_NCHANNELS = 1
range 0 6
config ESPRESSIF_LEDC_TIMER0_RESOLUTION
@@ -3701,8 +3700,8 @@ if ESPRESSIF_LEDC_TIMER1
config ESPRESSIF_LEDC_TIMER1_CHANNELS
int "Number of Timer 1 channels"
default 2 if PWM_MULTICHAN && PWM_NCHANNELS > 1
default 1 if !PWM_MULTICHAN || PWM_NCHANNELS = 1
default 2 if PWM_NCHANNELS > 1
default 1 if PWM_NCHANNELS = 1
range 0 6
config ESPRESSIF_LEDC_TIMER1_RESOLUTION
@@ -3725,8 +3724,8 @@ if ESPRESSIF_LEDC_TIMER2
config ESPRESSIF_LEDC_TIMER2_CHANNELS
int "Number of Timer 2 channels"
default 2 if PWM_MULTICHAN && PWM_NCHANNELS > 1
default 1 if !PWM_MULTICHAN || PWM_NCHANNELS = 1
default 2 if PWM_NCHANNELS > 1
default 1 if PWM_NCHANNELS = 1
range 0 6
config ESPRESSIF_LEDC_TIMER2_RESOLUTION
@@ -3749,8 +3748,8 @@ if ESPRESSIF_LEDC_TIMER3
config ESPRESSIF_LEDC_TIMER3_CHANNELS
int "Number of Timer 3 channels"
default 2 if PWM_MULTICHAN && PWM_NCHANNELS > 1
default 1 if !PWM_MULTICHAN || PWM_NCHANNELS = 1
default 2 if PWM_NCHANNELS > 1
default 1 if PWM_NCHANNELS = 1
range 0 6
config ESPRESSIF_LEDC_TIMER3_RESOLUTION
@@ -3781,7 +3780,7 @@ config ESPRESSIF_LEDC_CHANNEL3_PIN
int "Channel 3 pin"
default 5
if PWM_MULTICHAN && PWM_NCHANNELS > 1
if PWM_NCHANNELS > 1
config ESPRESSIF_LEDC_CHANNEL4_PIN
int "Channel 4 pin"
@@ -3791,7 +3790,7 @@ config ESPRESSIF_LEDC_CHANNEL5_PIN
int "Channel 5 pin"
default 7
endif # PWM_MULTICHAN && PWM_NCHANNELS > 1
endif # PWM_NCHANNELS > 1
endmenu # LEDC configuration
-1
View File
@@ -185,7 +185,6 @@ config ESP32C3_LEDC
bool "LEDC (PWM)"
default n
select PWM
select ARCH_HAVE_PWM_MULTICHAN
config ESP32C3_GPIO_IRQ
bool "GPIO pin interrupts"

Some files were not shown because too many files have changed in this diff Show More