public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
From: Evgeniy Dushistov <dushistov@mail.ru>
To: ecos-patches@ecos.sourceware.org
Cc: Uwe Kindler <uwe_kindler@web.de>
Subject: [PATCH] fixes for at91 can driver
Date: Tue, 01 Sep 2009 17:26:00 -0000	[thread overview]
Message-ID: <20090901172723.GA13991@rain> (raw)

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

Hi,

I have two problems with can_at91sam7 driver when
try to use it with at91sam9263 cpu, but I suppose
the same problems should happened with at91sam7 also.

Problem 1.
If standard id parameter is on,
then I always receive messages with zero length.

The root of evil is that driver hold id and length
data in the same field of structure, and set id after
length, so it zeroize the length part of field.

See the first attached patch.

Problem 2.

If I call can_write several times without delay,
can controller actualy send only the first one message.
This is because of isr in can_at91sam7.c masks interrupt after
it occurs, and interrupt enabled only in start_xmit implementation,
start_xmit called only in can_write, so if messages copied
into internal buffer, only the first one will be send,
because of isr mask transmit notification interrupt,
and it never enabled, so no new isr, no new dsr.
But only can_at91sam7's dsr handler call can_xmt_msg, so no new
messages will be copied from internal buffer to can controller.

See the second attached patch.

-- 
/Evgeniy

[-- Attachment #2: 0001-fix-dlc-always-zero-if-CYGOPT_IO_CAN_STD_CAN_ID-is.patch --]
[-- Type: text/plain, Size: 852 bytes --]

 .../arm/at91/at91sam7/current/src/can_at91sam7.c   |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/packages/devs/can/arm/at91/at91sam7/current/src/can_at91sam7.c b/packages/devs/can/arm/at91/at91sam7/current/src/can_at91sam7.c
index 763ffeb..30408ff 100644
--- a/packages/devs/can/arm/at91/at91sam7/current/src/can_at91sam7.c
+++ b/packages/devs/can/arm/at91/at91sam7/current/src/can_at91sam7.c
@@ -1234,7 +1234,8 @@ static bool at91sam7_can_getevent(can_channel *chan, CYG_CAN_EVENT_T *pevent, vo
 #endif // CYGOPT_IO_CAN_EXT_CAN_ID
             {
 #ifdef CYGOPT_IO_CAN_STD_CAN_ID
-                pevent->msg.id = MID_GET_STD(mid);
+                //in this case we hold dlc in id, so "|="
+                pevent->msg.id |= MID_GET_STD(mid);
 #endif // CYGOPT_IO_CAN_STD_CAN_ID
             }
             
-- 
1.6.0.6


[-- Attachment #3: 0002-fix-such-case.patch --]
[-- Type: text/plain, Size: 863 bytes --]

 .../arm/at91/at91sam7/current/src/can_at91sam7.c   |    4 +++-
 packages/devs/mil_std_1553/current/src/mkocore     |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/packages/devs/can/arm/at91/at91sam7/current/src/can_at91sam7.c b/packages/devs/can/arm/at91/at91sam7/current/src/can_at91sam7.c
index 30408ff..2e27c00 100644
--- a/packages/devs/can/arm/at91/at91sam7/current/src/can_at91sam7.c
+++ b/packages/devs/can/arm/at91/at91sam7/current/src/can_at91sam7.c
@@ -1167,8 +1167,10 @@ static bool at91sam7_can_putmsg(can_channel *priv, CYG_CAN_MSG_T *pmsg, void *pd
     {
         mcr |= MCR_RTR;
     }
-    
+    cyg_drv_dsr_lock();
     HAL_WRITE_UINT32(CAN_MB_MCR(info, CAN_MBOX_TX(info)), mcr);
+    HAL_WRITE_UINT32(CAN_IER(info), 0x01 << CAN_MBOX_TX(info)); // enable tx interrupt
+    cyg_drv_dsr_unlock();
     return true;
 }
 

                 reply	other threads:[~2009-09-01 17:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090901172723.GA13991@rain \
    --to=dushistov@mail.ru \
    --cc=ecos-patches@ecos.sourceware.org \
    --cc=uwe_kindler@web.de \
    /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).