[U-Boot-Users] possible ELDK4 gcc compiler bug

Matthias Fuchs matthias.fuchs at esd-electronics.com
Thu Dec 7 18:12:38 CET 2006


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
-----------------------------------------------------------------------





More information about the U-Boot mailing list