From 6a62119514c225b0d26e4c356c45dd4ea6466e9f Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 30 Mar 2014 09:18:54 +0000 Subject: Bug fixes for AT91SAM7 GPT driver git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@6826 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/AT91SAM7/gpt_lld.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'os/hal') diff --git a/os/hal/platforms/AT91SAM7/gpt_lld.c b/os/hal/platforms/AT91SAM7/gpt_lld.c index 703788ebf..8cd226e5d 100644 --- a/os/hal/platforms/AT91SAM7/gpt_lld.c +++ b/os/hal/platforms/AT91SAM7/gpt_lld.c @@ -362,7 +362,10 @@ void gpt_lld_stop(GPTDriver *gptp) { */ void gpt_lld_start_timer(GPTDriver *gptp, gptcnt_t interval) { gpt_lld_change_interval(gptp, interval); - gptp->tc->TC_CMR &= ~AT91C_TC_CPCDIS; + if (gptp->state == GPT_ONESHOT) + gptp->tc->TC_CMR |= AT91C_TC_CPCDIS; + else + gptp->tc->TC_CMR &= ~AT91C_TC_CPCDIS; gptp->tc->TC_CCR = AT91C_TC_CLKEN|AT91C_TC_SWTRG; if (gptp->config->callback) gptp->tc->TC_IER = AT91C_TC_CPCS|AT91C_TC_COVFS; @@ -415,7 +418,7 @@ void gpt_lld_change_interval(GPTDriver *gptp, gptcnt_t interval) { rc >>= 9; cmr = AT91C_TC_CLKS_TIMER_DIV5_CLOCK; } - gptp->tc->TC_CMR = (gptp->tc->TC_CMR & AT91C_TC_CLKS) | cmr; + gptp->tc->TC_CMR = (gptp->tc->TC_CMR & ~AT91C_TC_CLKS) | cmr; gptp->tc->TC_RC = rc; gptp->tc->TC_RA = rc/2; } else { -- cgit v1.2.3