public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Ezequiel Augusto Cachão Conde" <ezeq@cc.isel.ipl.pt>
To: <ecos-discuss@sources.redhat.com>
Subject: [ECOS] at91_misc.c patch proposal
Date: Tue, 31 May 2005 11:33:00 -0000	[thread overview]
Message-ID: <20050531113300.ptzabk4dhGO5M1-4kC9zd7_4W0uSLxeB7TnBLonRick@z> (raw)

[-- Attachment #1: Type: text/plain, Size: 290 bytes --]

Hi, 


I found a small bug in hal_delay_us. Once the timer is started it continues
running beyond the first counting. If hal_delay is called again, after a
complete counting, CPC flag is already set.

My patch simply clears the status flags before initiate a new delay.
 

Thanks

Ezequiel

[-- Attachment #2: at91_misc.patch --]
[-- Type: application/octet-stream, Size: 1431 bytes --]

Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/ChangeLog,v
retrieving revision 1.27
diff -u -5 -p -r1.27 ChangeLog
--- ChangeLog	12 Nov 2004 09:45:15 -0000	1.27
+++ ChangeLog	30 May 2005 14:58:19 -0000
@@ -1,5 +1,10 @@
+
+2005-05-30  Ezequiel Conde <ezeq@cc.isel.ipl.pt>
+
+	* src/at91_misc.c ( hal_delay_us ): Clear status before running delay
+	
 2004-11-12  Jani Monoses <jani@iv.ro>
 
 	* include/var_io.h: Added defines for some missing UART bits,
 	corrected a few timer capture mode register bits.
 
Index: src/at91_misc.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/src/at91_misc.c,v
retrieving revision 1.10
diff -u -5 -p -r1.10 at91_misc.c
--- src/at91_misc.c	25 Sep 2004 09:44:10 -0000	1.10
+++ src/at91_misc.c	30 May 2005 14:58:21 -0000
@@ -146,10 +146,13 @@ void hal_delay_us(cyg_int32 usecs)
     // Set registers
     HAL_WRITE_UINT32(timer+AT91_TC_CMR, AT91_TC_CMR_CLKS_MCK32);  // 1MHz
     HAL_WRITE_UINT32(timer+AT91_TC_RA, 0);
     HAL_WRITE_UINT32(timer+AT91_TC_RC, ticks);
 
+	// Clear status flags
+    HAL_READ_UINT32(timer+AT91_TC_SR, stat);
+
     // Start timer
     HAL_WRITE_UINT32(timer+AT91_TC_CCR, AT91_TC_CCR_TRIG | AT91_TC_CCR_CLKEN);
 
     // Wait for the compare
     do {


[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

             reply	other threads:[~2005-05-30 15:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-31 11:33 Ezequiel Augusto Cachão Conde [this message]
     [not found] <E1Dclxr-000180-00@londo.lunn.ch>
2005-06-12 13:34 ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050531113300.ptzabk4dhGO5M1-4kC9zd7_4W0uSLxeB7TnBLonRick@z \
    --to=ezeq@cc.isel.ipl.pt \
    --cc=ecos-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).