예제 #1
0
extern hal_result_t hal_core_init(const hal_core_cfg_t *cfg) 
{
   
    if(NULL == cfg)
    {   
        hal_base_on_fatalerror(hal_fatalerror_missingconfiguration, "hal_core_init() needs cfg");
        return(hal_res_NOK_generic);
    }
    
    if(hal_core_status_zero != s_hal_core_theinternals.status)
    {
        hal_base_on_fatalerror(hal_fatalerror_generic, "hal_core_init() already called");
        return(hal_res_NOK_generic);    
    }
    
    
    // sets used config. it may be used to retrieve params for hal_cpu_init() and hal_sys_init()
    
    memcpy(&s_hal_core_theinternals.config, cfg, sizeof(hal_core_cfg_t));    
    
     
    // call something which prepares memory in core modules
    s_hal_core_modules_in_core_static_memory_init();
    
    // call something which prepares memory of other modules specified in brdcfg
    s_hal_core_modules_in_brdcfg_static_memory_init();
    
    
    // -- call initialisation of base    
    hal_base_init(&cfg->basecfg);
    
    // -- call initialisation of cpu
    hal_cpu_init(&cfg->cpucfg);
    
    // -- call initialisation of flash   
    hal_flash_init(&cfg->flashcfg);    
    
    // -- call initialisation of sys   
    hal_sys_init(&cfg->syscfg);
    
   
    // sets initialisation done
    s_hal_core_theinternals.status = hal_core_status_initialised;
    
    return(hal_res_OK);
}
예제 #2
0
void hal_board_init(void){
 	hal_cpu_init();
}