/*                                                                          */
/* Function    : manages initialization flow                                */
/*                                                                          */
/* Used By     : DSP                                                        */
/*                                                                          */
/*                                                                          */

#include  "windef.h"
#include  "mbdr_dsp_common_main_init_manager.h"
#include  "mbdr_dsp_common_status.h"
#include  "mbdr_dsp_core_type_const.h"
#include  "mbdr_dsp_common_sync_msg.h"
#include  "mbdr_dsp_platform_proc_ptrs.h"


/*  called while:                                            */
/*    condition _config[0].common.re_synchronization_request */
void mbdr_dsp_main_kernel_loop(void)
{/* mbdr_dsp_main_kernel_loop */

  mbdr_dsp_common_config_t *mbdr_dsp_common_config_p;

  /* clears config ready indication */
  mbdr_dsp_common_config_p =
       (mbdr_dsp_common_config_t *)
	   ( MBDR_DSP_CPU_DSP_CONFIG_BYTE_OFFSET
	    +MBDR_DSP_COMMON_L2_BASE);

  mbdr_dsp_core_process_proc_ptrs.main_loop_init(
                        mbdr_dsp_common_config_p->multi_core);


  /* deletes previous user resynchronization request */
  mbdr_dsp_common_config_p->re_synchronization_request 
          =  MBDR_DSP_RE_SYNCHRONIZATION_REQUEST_T_NO_REQUEST;


  /* infinite loop call */
  while(mbdr_dsp_common_config_p->re_synchronization_request
        !=
        MBDR_DSP_RE_SYNCHRONIZATION_REQUEST_T_RESYNC_WITHOUT_FLASH_REREAD)
  {/* application main while run kernel */

     /* report main module code to status structure */
     MBDR_DSP_SET_SW_MAIN_MODULE_CODE_M(
            MBDR_DSP_MAIN_MODULE_CODE_T_MAIN_LOOP);

     /* runs main kernel  */
     mbdr_dsp_core_process_proc_ptrs.main_loop_kernel(
                        mbdr_dsp_common_config_p->multi_core);

     /* report main module code to status structure */
     MBDR_DSP_SET_SW_MAIN_MODULE_CODE_M(
            MBDR_DSP_MAIN_MODULE_CODE_T_MAIN_LOOP_HOOK);

     /* platform/core depend debug hook, in operational system it does nothing */
     mbdr_dsp_platform_core_debug_proc_ptrs.dsp_main_loop_kernel_debug_hook();

  }/* application main while run kernel */

}/* mbdr_dsp_main_kernel_loop */
