[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/7] STM32F2xx: Display PWM duty cycle from t
From: |
Peter Crosthwaite |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/7] STM32F2xx: Display PWM duty cycle from timer |
Date: |
Fri, 29 May 2015 23:42:04 -0700 |
On Fri, May 29, 2015 at 10:45 PM, Alistair Francis <address@hidden> wrote:
> If correctly configured allow the STM32F2xx timer to print
> out the PWM duty cycle information.
>
> Signed-off-by: Alistair Francis <address@hidden>
> ---
> V2:
> - Fix up if statement braces
> - Remove stm32f2xx_timer_set_alarm() call
>
> hw/timer/stm32f2xx_timer.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/hw/timer/stm32f2xx_timer.c b/hw/timer/stm32f2xx_timer.c
> index ecadf9d..de4b8af 100644
> --- a/hw/timer/stm32f2xx_timer.c
> +++ b/hw/timer/stm32f2xx_timer.c
> @@ -49,6 +49,15 @@ static void stm32f2xx_timer_interrupt(void *opaque)
> qemu_irq_pulse(s->irq);
> stm32f2xx_timer_set_alarm(s, s->hit_time);
> }
> +
> + if (s->tim_ccmr1 & (TIM_CCMR1_OC2M2 + TIM_CCMR1_OC2M1) &&
Use | to combine multiple masks together (to show you are doing bit
operations rather than arithmetic).
> + !(s->tim_ccmr1 & TIM_CCMR1_OC2M0) &&
> + s->tim_ccmr1 & TIM_CCMR1_OC2PE &&
> + s->tim_ccer & TIM_CCER_CC2E) {
> + /* PWM 2 - Mode 1 */
> + DB_PRINT("Duty Cycle: %d%%\n",
> + s->tim_ccr2 / (100 * (s->tim_psc + 1)));
You should be more descriptive and give more context to the print. Add
the timer name and "PWM" in there.
Otherwise:
Reviewed-by: Peter Crosthwaite <address@hidden>
Regards,
Peter
> + }
> }
>
> static inline int64_t stm32f2xx_ns_to_ticks(STM32F2XXTimerState *s, int64_t
> t)
> --
> 2.1.4
>
>
- [Qemu-devel] [PATCH v2 0/7] Update the Netduino 2 Machine, Alistair Francis, 2015/05/30
- [Qemu-devel] [PATCH v2 1/7] STM32F205: Remove the individual device variables, Alistair Francis, 2015/05/30
- [Qemu-devel] [PATCH v2 2/7] STM32F2xx: Display PWM duty cycle from timer, Alistair Francis, 2015/05/30
- Re: [Qemu-devel] [PATCH v2 2/7] STM32F2xx: Display PWM duty cycle from timer,
Peter Crosthwaite <=
- [Qemu-devel] [PATCH v2 3/7] STM32F2xx: Add the ADC device, Alistair Francis, 2015/05/30
- [Qemu-devel] [PATCH v2 4/7] STM32F2xx: Add the SPI device, Alistair Francis, 2015/05/30
- [Qemu-devel] [PATCH v2 7/7] MAINTAINERS: Add Alistair to the maintainers list, Alistair Francis, 2015/05/30