From: Wolfgang Grandegger <wg@domain.hid>
To: Frits de Klark <mailing.xenomai@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] size of the struct can_frame
Date: Mon, 04 Dec 2006 12:56:51 +0100 [thread overview]
Message-ID: <45740D03.5090708@domain.hid> (raw)
In-Reply-To: <54b161f50612040334v3244d551l56868ec221bd5dcb@domain.hid>
Frits de Klark wrote:
> Hello everyone,
>
> I noticed that the sizeof() function reports that the struct can_frame
> has a size of 16 bytes. I know that this is because of memory aligning
> done by the GNU compiler.
This is just a structure to pass message data from and to the CAN driver.
> But now I wonder if there are actually 16 bytes transferred over the CAN
> bus. I guess not, since it has such a strict and well-defined format,
> but I'd like to have this confirmed by someone, please.
The format of the data actually transferred over the bus is defined in
the CAN bus standard. And the driver just programs the appropriate
registers of the CAN controller.
> The size of 16 bytes though, is also passed to the rt_dev_recv() and
> rt_dev_send() functions, so this is where I get confused: Are the
> correct bytes extracted from this 16 byte block at a later stage (the
> CAN driver)?
Yes, of course. And the internal ringer buffers for received messages
also use a "packed" format.
> I'm asking this to make sure that if, for example, I'd like to store all
> the received frames in a binary file, I don't need to store all 16
> bytes, just the 13 (right?) that are in use.
You need to store (5 + can_dlc) bytes.
>
> I hope I made myself clear.
>
> Thanks in advance and best regards!
Wolfgang.
prev parent reply other threads:[~2006-12-04 11:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-04 11:34 [Xenomai-help] size of the struct can_frame Frits de Klark
2006-12-04 11:56 ` Wolfgang Grandegger [this message]
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=45740D03.5090708@domain.hid \
--to=wg@domain.hid \
--cc=mailing.xenomai@domain.hid \
--cc=xenomai@xenomai.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.