[U-Boot] [PATCH v2 13/22] omap4: add clock support
Aneesh V
aneesh at ti.com
Tue Jun 21 09:05:55 CEST 2011
On Tuesday 21 June 2011 12:35 PM, Wolfgang Denk wrote:
> 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;
>> };
>>
The const for structure fields above were not intended. I put them
while debugging this issue and forgot to remove later.
>> 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];
> };
> ?
I want a number of register addresses in an array - an array of
constant pointers. The array is populated at compile time with the
addresses of all the modules that need to be initialized. At run-time I
do a specific operation on all the registers given in this array.
best regards,
Aneesh
More information about the U-Boot
mailing list