* [PATCH] fixes for at91 can driver
@ 2009-09-01 17:26 Evgeniy Dushistov
0 siblings, 0 replies; only message in thread
From: Evgeniy Dushistov @ 2009-09-01 17:26 UTC (permalink / raw)
To: ecos-patches; +Cc: Uwe Kindler
[-- 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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-09-01 17:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-01 17:26 [PATCH] fixes for at91 can driver Evgeniy Dushistov
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).