/*-------------------------------------------------------------------------+
|         Function: bsp_start
|      Description: Called before main is invoked.
| Global Variables: None.
|        Arguments: None.
|          Returns: Nothing.
+--------------------------------------------------------------------------*/
void bsp_start_default( void )
{
  int pci_init_retval;

  /*
   *  We need to determine how much memory there is in the system.
   */
  bsp_size_memory();

  /*
   * Calibrate variable for 1ms-loop (see timer.c)
   */
  Calibrate_loop_1ms();

  /*
   * Init rtems interrupt management
   */
  rtems_irq_mngt_init();
  /*
   * Init rtems exceptions management
   */
  rtems_exception_init_mngt();

  /*
   * init PCI Bios interface...
   */
  pci_init_retval = pci_initialize();
  if (pci_init_retval != PCIB_ERR_SUCCESS) {
      printk("PCI bus: could not initialize PCI BIOS interface\n");
  }

  bsp_ide_cmdline_init ();

} /* bsp_start */
void bsp_start_default( void )
{
    /* disable interrupts */
    *EP7312_INTMR1 = 0;
    *EP7312_INTMR2 = 0;
    Cpu_table.pretasking_hook        = bsp_pretasking_hook;
    Cpu_table.postdriver_hook        = bsp_postdriver_hook;

    /* Place RTEMS workspace at beginning of free memory. */
    BSP_Configuration.work_space_start = (void *)&_bss_free_start;

    free_mem_start = ((uint32_t)&_bss_free_start +
                      BSP_Configuration.work_space_size);

    free_mem_end = ((uint32_t)&_sdram_base + (uint32_t)&_sdram_size);

    /*
     * Init rtems exceptions management
     */
    rtems_exception_init_mngt();

    /*
     * Init rtems interrupt management
     */
    rtems_irq_mngt_init();

    /*
     *  The following information is very useful when debugging.
     */
#if 0
    printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
    printk( "maximum_extensions = 0x%x\n", BSP_Configuration.maximum_extensions );
    printk( "microseconds_per_tick = 0x%x\n",
            BSP_Configuration.microseconds_per_tick );
    printk( "ticks_per_timeslice = 0x%x\n",
            BSP_Configuration.ticks_per_timeslice );
    printk( "number_of_device_drivers = 0x%x\n",
            BSP_Configuration.number_of_device_drivers );
    printk( "Device_driver_table = 0x%x\n",
            BSP_Configuration.Device_driver_table );

    /*  printk( "_stack_size = 0x%x\n", _stack_size );*/
    printk( "work_space_start = 0x%x\n", BSP_Configuration.work_space_start );
    printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
#endif
} /* bsp_start */
/*-------------------------------------------------------------------------+
|         Function: bsp_start
|      Description: Called before main is invoked.
| Global Variables: None.
|        Arguments: None.
|          Returns: Nothing.
+--------------------------------------------------------------------------*/
void bsp_start_default( void )
{
    mmu_sect_map_t mem_map[] = {
        {0x00000000, 0x0c000000,   1, MMU_CACHE_NONE},    /* Mirror of SDRAM for the vector handler*/
        {0x0c000000, 0x0c000000,   8, MMU_CACHE_WTHROUGH},     /* SDRAM */
        {0x14000000, 0x14000000,   1, MMU_CACHE_NONE},     /* Internals Regs - */
        {0x15000000, 0x15000000,   1, MMU_CACHE_NONE},     /* Specials Internal Regs - */
    };

    /* If we don't have command line arguments set default program name. */

    Cpu_table.pretasking_hook         = bsp_pretasking_hook; /* init libc, etc. */
    Cpu_table.predriver_hook          = NULL;                /* use system's    */
    Cpu_table.postdriver_hook         = bsp_postdriver_hook;
    Cpu_table.idle_task               = NULL;
    /* do not override system IDLE task */
    Cpu_table.do_zero_of_workspace    = TRUE;
    Cpu_table.interrupt_stack_size    = 4096;
    Cpu_table.extra_mpci_receive_server_stack = 0;

    /*disable interrupts */
    rINTMSK=0xffffffff;//unmasked by dirvers

    /* Place RTEMS workspace at beginning of free memory. */
    BSP_Configuration.work_space_start = (void *)&_bss_free_start;

    free_mem_start = ((unsigned32)&_bss_free_start + BSP_Configuration.work_space_size);

    free_mem_end = ((unsigned32)&_sdram_base + (unsigned32)&_sdram_size);

    /*enable the MMU*/
    mmu_init(mem_map, (sizeof(mem_map) / sizeof(mmu_sect_map_t)));

    /*
     * Init rtems exceptions management
     */
    rtems_exception_init_mngt();

    /*
     * Init rtems interrupt management
     */
    rtems_irq_mngt_init();

    /*
     *  The following information is very useful when debugging.
     */

#if 0
    printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
    printk( "maximum_extensions = 0x%x\n", BSP_Configuration.maximum_extensions );
    printk( "microseconds_per_tick = 0x%x\n",
            BSP_Configuration.microseconds_per_tick );
    printk( "ticks_per_timeslice = 0x%x\n",
            BSP_Configuration.ticks_per_timeslice );
    printk( "maximum_devices = 0x%x\n", BSP_Configuration.maximum_devices );
    printk( "number_of_device_drivers = 0x%x\n",
            BSP_Configuration.number_of_device_drivers );
    printk( "Device_driver_table = 0x%x\n",
            BSP_Configuration.Device_driver_table );

    printk( "_heap_size = 0x%x\n", _heap_size );
    /*  printk( "_stack_size = 0x%x\n", _stack_size );*/
    printk( "rtemsFreeMemStart = 0x%x\n", rtemsFreeMemStart );
    printk( "work_space_start = 0x%x\n", BSP_Configuration.work_space_start );
    printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
#endif

} /* bsp_start */