[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 2/8] STM32F2xx: Display PWM duty cycle from timer
From: |
Alistair Francis |
Subject: |
[Qemu-devel] [PATCH v8 2/8] STM32F2xx: Display PWM duty cycle from timer |
Date: |
Sat, 24 Sep 2016 12:20:03 -0700 |
If correctly configured allow the STM32F2xx timer to print
out the PWM duty cycle information.
Signed-off-by: Alistair Francis <address@hidden>
Reviewed-by: Peter Crosthwaite <address@hidden>
---
V3:
- Use OR instead of + for masking
- Improve clarity of print statement
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 bf0fb28..8c4c1f9 100644
--- a/hw/timer/stm32f2xx_timer.c
+++ b/hw/timer/stm32f2xx_timer.c
@@ -51,6 +51,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) &&
+ !(s->tim_ccmr1 & TIM_CCMR1_OC2M0) &&
+ s->tim_ccmr1 & TIM_CCMR1_OC2PE &&
+ s->tim_ccer & TIM_CCER_CC2E) {
+ /* PWM 2 - Mode 1 */
+ DB_PRINT("PWM2 Duty Cycle: %d%%\n",
+ s->tim_ccr2 / (100 * (s->tim_psc + 1)));
+ }
}
static inline int64_t stm32f2xx_ns_to_ticks(STM32F2XXTimerState *s, int64_t t)
--
2.7.4
- [Qemu-devel] [PATCH v8 0/8] Update the Netduino 2 Machine, Alistair Francis, 2016/09/24
- [Qemu-devel] [PATCH v8 1/8] STM32F205: Remove the individual device variables, Alistair Francis, 2016/09/24
- [Qemu-devel] [PATCH v8 2/8] STM32F2xx: Display PWM duty cycle from timer,
Alistair Francis <=
- [Qemu-devel] [PATCH v8 3/8] STM32F2xx: Add the ADC device, Alistair Francis, 2016/09/24
- [Qemu-devel] [PATCH v8 4/8] STM32F2xx: Add the SPI device, Alistair Francis, 2016/09/24
- [Qemu-devel] [PATCH v8 5/8] irq: Add a new irq device that allows the ORing of lines, Alistair Francis, 2016/09/24
- [Qemu-devel] [PATCH v8 6/8] STM32F205: Connect the ADC devices, Alistair Francis, 2016/09/24
- [Qemu-devel] [PATCH v8 7/8] STM32F205: Connect the SPI devices, Alistair Francis, 2016/09/24
- [Qemu-devel] [PATCH v8 8/8] MAINTAINERS: Add Alistair to the maintainers list, Alistair Francis, 2016/09/24