From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brP3x-00008M-2E for qemu-devel@nongnu.org; Tue, 04 Oct 2016 08:43:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brP3r-0006OF-5O for qemu-devel@nongnu.org; Tue, 04 Oct 2016 08:43:12 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:47188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brP3q-0006Lo-Vk for qemu-devel@nongnu.org; Tue, 04 Oct 2016 08:43:07 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1brP3h-0005ih-7K for qemu-devel@nongnu.org; Tue, 04 Oct 2016 13:42:57 +0100 From: Peter Maydell Date: Tue, 4 Oct 2016 13:42:30 +0100 Message-Id: <1475584975-25099-3-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1475584975-25099-1-git-send-email-peter.maydell@linaro.org> References: <1475584975-25099-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PULL 02/27] STM32F2xx: Display PWM duty cycle from timer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Alistair Francis If correctly configured allow the STM32F2xx timer to print out the PWM duty cycle information. Signed-off-by: Alistair Francis Reviewed-by: Peter Crosthwaite Message-id: cdb59039a25e061615713a94b40797baa12ea9f9.1474742262.git.alistair@alistair23.me Signed-off-by: Peter Maydell --- 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