public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] possible ELDK4 gcc compiler bug
Date: Thu, 7 Dec 2006 18:12:38 +0100	[thread overview]
Message-ID: <200612071812.39035.matthias.fuchs@esd-electronics.com> (raw)
In-Reply-To: <29294F14-A88D-4027-A941-B5AF3DE19B87@gmail.com>

On Thursday 07 December 2006 17:38, Pantelis Antoniou wrote:
> 
> But you should really be using accessors...
You might be right, but I really like to lay a struct over a IO-controllers 
registers.

Do so with accessors result in code like this (still missing some casts):

out32(&(fpga->fifo[i].ctrl), in32(&(fpga->fifo[i].ctrl)) | 0x8000);

Is this really recommended?

For simple IO operations 

out32(FPGA_FIFO_CTRL, in32(FPGA_FIFO_CTRL) | 0x8000);

is fine. But with a more complex register layout like this:

struct pmc405v2_fpga_s {
????????volatile u32 ctrl;
????????volatile u32 status;
????????volatile u32 test1;
????????volatile u32 test2;
????????u32 pad1[0x60 / sizeof(u32) - 4];
????????volatile u32 hostctrl; ? ? ? ? ? ? ? ? ? /* 0x0060 */
????????u32 pad2[0x20 / sizeof(u32) - 1];
????????struct pmc405v2_fifo_s fifo[FIFO_COUNT]; /* 0x0080..0x009f */
};

It results in ugly code.

Matthias

-- 
-----------------------------------------------------------------------
Dipl.-Ing. Matthias Fuchs             esd electronic system design gmbh
http://www.esd-electronics.com                    Vahrenwalder Str. 207
phone: +49-511-37298-0, fax: -68                30165 Hannover, Germany
-----------------------------------------------------------------------

  reply	other threads:[~2006-12-07 17:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-07 16:21 [U-Boot-Users] possible ELDK4 gcc compiler bug Matthias Fuchs
2006-12-07 16:28 ` Matthias Fuchs
2006-12-07 16:38   ` Pantelis Antoniou
2006-12-07 17:12     ` Matthias Fuchs [this message]
2006-12-07 17:25       ` Timur Tabi
2006-12-07 17:33         ` Pantelis Antoniou
2006-12-07 16:42   ` Rune Torgersen
2006-12-07 16:55     ` Matthias Fuchs
2006-12-07 16:29 ` Pantelis Antoniou
2006-12-07 16:42 ` Tolunay Orkun

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=200612071812.39035.matthias.fuchs@esd-electronics.com \
    --to=matthias.fuchs@esd-electronics.com \
    --cc=u-boot@lists.denx.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