[U-Boot] [PATCH v2 13/22] omap4: add clock support

Wolfgang Denk wd at denx.de
Tue Jun 21 09:05:30 CEST 2011


Dear Aneesh V,

In message <4E0030F8.6030104 at ti.com> you wrote:
> 
> I am finding it difficult to implement this using the struct based
> approach. I tried the sample code below:
> 
> struct my_regs_struct {
> 	const unsigned int reg1;
> 	const unsigned int reg2;
> 	const unsigned int reg3;
> };
> 
> static struct my_regs_struct *const my_regs = (struct my_regs_struct 
> *)0x1000;
> 
> static unsigned int *const reg_arr[] = {
> 	&my_regs->reg1,
> 	&my_regs->reg3
> };
> 
> void main(void)
> {
> 	printf("regs %x %x \n", reg_arr[0], reg_arr[1]);
> }

Sorry, but I fail to understand the problem.  Why is reg_arr[] needed?
Why don't you use

	struct my_regs_struct {
		const unsigned int reg[3];
	};
?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
But it's real. And if it's real it can be affected ... we may not  be
able  to break it, but, I'll bet you credits to Navy Beans we can put
a dent in it.
	-- deSalle, "Catspaw", stardate 3018.2


More information about the U-Boot mailing list