From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Fuchs Date: Thu, 7 Dec 2006 18:12:38 +0100 Subject: [U-Boot-Users] possible ELDK4 gcc compiler bug In-Reply-To: <29294F14-A88D-4027-A941-B5AF3DE19B87@gmail.com> References: <200612071721.10783.matthias.fuchs@esd-electronics.com> <200612071728.30527.matthias.fuchs@esd-electronics.com> <29294F14-A88D-4027-A941-B5AF3DE19B87@gmail.com> Message-ID: <200612071812.39035.matthias.fuchs@esd-electronics.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 -----------------------------------------------------------------------