[U-Boot-Users] [PATCH] Functions added to extern for stand alone programs

Amnon Cohen amnon.uboot at gmail.com
Thu May 10 11:48:47 CEST 2007


my gut feeling is that

        gd->jt[XF_foo]  = foo;

should happen at the end of the file which defines foo.
This would remove the need for external definitions and ifdef mazes.
But it would require some sort of jt_init function to be called in each file.
This could be done using some linker magic (like module initialization
in the kernel, or cli functions in u-boot)...

- Amnon


On 5/9/07, Wolfgang Denk <wd at denx.de> wrote:
> In message <1628E43D99629C46988BE46087A3FBB997B7A9 at ep-01.EmbeddedPlanet.local> you wrote:
> >
> > [PATCH] Functions added to extern for stand alone programs
> ...
> > Content-Transfer-Encoding: base64
> > Content-Description: add_extern_func.patch
> > Content-Disposition: attachment;
> >       filename=add_extern_func.patch"
> >
> > RnJvbSAyMDBhZWNiZjJiM2NlYzA0ZDA5M2RkZGRlMWViNWQxNDA1YmE1ZGVhIE1vbiBTZXAgMTcg
> > MDA6MDA6MDAgMjAwMQpGcm9tOiByb290IDxyb290QHVidW50dS4obm9uZSk+CkRhdGU6IFdlZCwg
> > OSBNYXkgMjAwNyAxMjo1NjozNSAtMDQwMApTdWJqZWN0OiBbUEFUQ0hdIEZ1bmN0aW9ucyBhZGRl
> ...
>
> Please post plain text.
>
> ...
> +#if defined (CONFIG_4xx)       || defined (CONFIG_MPC5xxx) || defined (CONFIG_74xx_7xx) || \
> +    defined (CONFIG_74x)       || defined (CONFIG_75x)     || defined (CONFIG_74xx)     || \
> +    defined (CONFIG_MPC8220)|| defined (CONFIG_MPC85xx)        || defined (CONFIG_MPC86xx)      || \
> +    defined (CONFIG_MPC83XX)
> +       gd->jt[XF_out8] = (void *) out8;
> +       gd->jt[XF_in8] = (void *) in8;
> +       gd->jt[XF_in16] = (void *) in16;
> +       gd->jt[XF_out16] = (void *) out16;
> +       gd->jt[XF_in32] = (void *) in32;
> +       gd->jt[XF_out32] = (void *) out32;
> +#endif
> +#if (CONFIG_COMMANDS & CFG_CMD_NET)
> +       gd->jt[XF_netboot_common] = (void *) netboot_common;
> +#endif
> +       gd->jt[XF_strcmp] = (void *) strcmp;
> +#if (CONFIG_COMMANDS & CFG_CMD_NAND)
> +       gd->jt[XF_do_nand] = (void *) do_nand;
> +#endif
> +#if (CONFIG_COMMANDS & CFG_CMD_DATE)
> +       gd->jt[XF_rtc_get] = (void *) rtc_get;
> +       gd->jt[XF_do_date] = (void *) do_date;
> +#endif
>  #if (CONFIG_COMMANDS & CFG_CMD_I2C)
>         gd->jt[XF_i2c_write] = (void *) i2c_write;
>         gd->jt[XF_i2c_read] = (void *) i2c_read;
> +       gd->jt[XF_i2c_probe] = (void *) i2c_probe;
>  #endif /* CFG_CMD_I2C */
> +#if (CONFIG_COMMANDS & CFG_CMD_USB)
> +       gd->jt[XF_usb_init] = (void *) usb_init;
> +       gd->jt[XF_usb_stop] = (void *) usb_stop;
> +#endif
> +#if !defined(CFG_NO_FLASH)
> +       gd->jt[XF_flash_write] = (void *) flash_write;
> +#endif
> +#if (CONFIG_COMMANDS & CFG_CMD_FLASH)
> +       gd->jt[XF_do_protect] = (void *) do_protect;
> +       gd->jt[XF_do_flerase] = (void *) do_flerase;
> +#endif
>  }
>
> This #ifdef maze is too much even for my  standards.  And  that  does
> mean something.
>
> Is there anybody out there with an idea how to avoid that?
>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,    CEO: 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
> If something is different, it's either better or worse,  and  usually
> both.                                                    - Larry Wall
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users
>




More information about the U-Boot mailing list