[<<][ecos][>>][..]
Sun Nov 13 09:10:47 EST 2011

eCos board support: how to add an _init() method?

How can you add an init method to a board support package?  I
currently have board-specific code added to hal_hardware_init() in the
at91_misc.c file from the at91 variant HAL.  How is this code registered?

In the following file I find somethings useful
./at91sam7/v3_0_9/include/plf_io.h:237:

//----------------------------------------------------------------------
// The platform needs this initialization during the
// hal_hardware_init() function in the varient HAL.

#ifndef __ASSEMBLER__
extern void hal_plf_hardware_init(void);
#define HAL_PLF_HARDWARE_INIT() \
    hal_plf_hardware_init()

#ifdef CYGHWR_HAL_ARM_AT91SAM7X
extern void hal_plf_eth_init(void);
#define HAL_PLF_ETH_INIT() \
    hal_plf_eth_init()
#endif          
#endif            //__ASSEMBLER__

Igoring that __ASSEMBLER__ part, depending on whether the
CYGHWR_HAL_ARM_AT91SAM7X option is defined, a macro HAL_PLF_ETH_INIT()
is defined.  Where is that called?

It's in the variant hal file's hal_hardware_init():

#ifdef CYGPKG_DEVS_ETH_ARM_AT91
#ifdef HAL_PLF_ETH_INIT
       HAL_PLF_ETH_INIT();
#endif
#endif


This is a bit of spaghetti isn't it?




[Reply][About]
[<<][ecos][>>][..]