[U-Boot] [PATCH] ftsmc020: enhance for features and asm support.

Macpaul Lin macpaul at gmail.com
Thu Mar 31 04:38:47 CEST 2011


Hi Wolfgang,


2011/3/25 Wolfgang Denk <wd at denx.de>:
> Dear macpaul at andestech.com,
>
> There is no (known) problem with it, but you have to be careful about
> the context you are running in - the script as is is supposed to be
> run in "make" context, which means different $ expansion rules then
> when you try running directly under a shell.

I'm not sure if this way I use make-asm-offset is correct.

First I add the OFFSET marco of ftsmc020 into "lib/asm-offsets.c".
The file "lib/asm-offsets.c" becomes
int main(void)
{
        /* Round up to make sure size gives nice stack alignment */
        DEFINE(GENERATED_GBL_DATA_SIZE,
                (sizeof(struct global_data) + 15) & ~15);

        DEFINE(GENERATED_BD_INFO_SIZE,
                (sizeof(struct bd_info) + 15) & ~15);

        OFFSET(FTSMC020_BANK0_CR,  ftsmc020, bank[0].cr);
        OFFSET(FTSMC020_BANK0_TPR, ftsmc020, bank[0].tpr);
        OFFSET(FTSMC020_BANK1_CR,  ftsmc020, bank[1].cr);
        OFFSET(FTSMC020_BANK1_TPR, ftsmc020, bank[1].tpr);
        OFFSET(FTSMC020_BANK2_CR,  ftsmc020, bank[2].cr);
        OFFSET(FTSMC020_BANK2_TPR, ftsmc020, bank[2].tpr);
        OFFSET(FTSMC020_BANK3_CR,  ftsmc020, bank[3].cr);
        OFFSET(FTSMC020_BANK3_TPR, ftsmc020, bank[3].tpr);
        OFFSET(FTSMC020_PAD0, ftsmc020, pad[0]);
        OFFSET(FTSMC020_PAD1, ftsmc020, pad[1]);
        OFFSET(FTSMC020_PAD2, ftsmc020, pad[2]);
        OFFSET(FTSMC020_PAD3, ftsmc020, pad[3]);
        OFFSET(FTSMC020_PAD4, ftsmc020, pad[4]);
        OFFSET(FTSMC020_PAD5, ftsmc020, pad[5]);
        OFFSET(FTSMC020_PAD6, ftsmc020, pad[6]);
        OFFSET(FTSMC020_PAD7, ftsmc020, pad[7]);
        OFFSET(FTSMC020_SSR, ftsmc020, ssr);
}

Then I ran make process, the result of make-asm-offset goes into
"include/generated/generic-asm-offsets.h" as
#define GENERATED_GBL_DATA_SIZE (80) /* (sizeof(struct global_data) +
15) & ~15 */
#define GENERATED_BD_INFO_SIZE (64) /* (sizeof(struct bd_info) + 15) & ~15 */
#define FTSMC020_BANK0_CR (0) /* offsetof(struct ftsmc020, bank[0].cr) */
#define FTSMC020_BANK0_TPR (4) /* offsetof(struct ftsmc020, bank[0].tpr) */
#define FTSMC020_BANK1_CR (8) /* offsetof(struct ftsmc020, bank[1].cr) */
#define FTSMC020_BANK1_TPR (12) /* offsetof(struct ftsmc020, bank[1].tpr) */
#define FTSMC020_BANK2_CR (16) /* offsetof(struct ftsmc020, bank[2].cr) */
#define FTSMC020_BANK2_TPR (20) /* offsetof(struct ftsmc020, bank[2].tpr) */
#define FTSMC020_BANK3_CR (24) /* offsetof(struct ftsmc020, bank[3].cr) */
#define FTSMC020_BANK3_TPR (28) /* offsetof(struct ftsmc020, bank[3].tpr) */
#define FTSMC020_PAD0 (32) /* offsetof(struct ftsmc020, pad[0]) */
#define FTSMC020_PAD1 (36) /* offsetof(struct ftsmc020, pad[1]) */
#define FTSMC020_PAD2 (40) /* offsetof(struct ftsmc020, pad[2]) */
#define FTSMC020_PAD3 (44) /* offsetof(struct ftsmc020, pad[3]) */
#define FTSMC020_PAD4 (48) /* offsetof(struct ftsmc020, pad[4]) */
#define FTSMC020_PAD5 (52) /* offsetof(struct ftsmc020, pad[5]) */
#define FTSMC020_PAD6 (56) /* offsetof(struct ftsmc020, pad[6]) */
#define FTSMC020_PAD7 (60) /* offsetof(struct ftsmc020, pad[7]) */
#define FTSMC020_SSR (64) /* offsetof(struct ftsmc020, ssr) */

However, this looks weird. It doesn't look like the other automated
generated code.
And, how does the offset address in decimal could be generated in hex?
Could I move the generated code into ftsmc020.h?

>
>> Moreover, the structure of ftsmc020 was nested like
>> struct ftsmc020 {
>>         struct {
>>                 unsigned int    cr;     /* 0x00, 0x08, 0x10, 0x18 */
>>                 unsigned int    tpr;    /* 0x04, 0x0c, 0x14, 0x1c */
>>         } bank[4];
>>         unsigned int    pad[8]; /* 0x20 - 0x3c */
>>         unsigned int    ssr;    /* 0x40 */
>> };

Thanks.

-- 
Best regards,
Macpaul Lin


More information about the U-Boot mailing list