예제 #1
0
파일: startup.c 프로젝트: lowagner/bitbox
void Reset_Handler()
{

	// Copy the data segment initializers from flash to SRAM.
	uint32_t *src=_sidata;
	for(uint32_t *dest=_sdata;dest<_edata;dest++) *dest=*src++;

	// Zero fill the bss segment.
	for(uint32_t *dest=_sbss;dest<_ebss;dest++) *dest=0;

	#ifdef CCM_MEMORY
	// Zero fill the CCM segment also. this is used by kernels to check if they're initialized (bad)
	for(uint32_t *dest=_sccm;dest<_eccm;dest++) *dest=0;
	#endif

	// misc initializations
	system_init(); // in board.c
	board_init();

	// USB first since it can be lengthy and should not be interrupted
	#ifndef NO_USB
	setup_usb();
	#endif

	#ifndef NO_AUDIO
	audio_init();
	#endif

	#if VGA_MODE!=NONE
	// be careful to initialize everything before (line callbacks ..)
	vga_setup();
	#endif



	// Call the application's entry point.
    main();

	// If main ever exits, lock up.
	for(;;);
}
예제 #2
0
파일: post.c 프로젝트: jibaron/q35-seabios
// Main setup code.
static void
maininit(void)
{
    // Setup romfile items.
    qemu_cfg_romfile_setup();
    coreboot_cbfs_setup();

    // Setup ivt/bda/ebda
    init_ivt();
    init_bda();

    // Init base pc hardware.
    pic_setup();
    timer_setup();
    mathcp_setup();

    // Initialize pci
    pci_setup();
    smm_init();

    // Initialize mtrr
    mtrr_setup();

    // Setup Xen hypercalls
    xen_init_hypercalls();

    // Initialize internal tables
    boot_setup();

    // Start hardware initialization (if optionrom threading)
    if (CONFIG_THREADS && CONFIG_THREAD_OPTIONROMS)
        init_hw();

    // Find and initialize other cpus
    smp_probe();

    // Setup interfaces that option roms may need
    bios32_setup();
    pmm_setup();
    pnp_setup();
    kbd_setup();
    mouse_setup();
    init_bios_tables();

    // Run vga option rom
    vga_setup();

    // Do hardware initialization (if running synchronously)
    if (!CONFIG_THREADS || !CONFIG_THREAD_OPTIONROMS) {
        init_hw();
        wait_threads();
    }

    // Run option roms
    optionrom_setup();

    // Run BCVs and show optional boot menu
    boot_prep();

    // Finalize data structures before boot
    cdemu_setup();
    pmm_finalize();
    malloc_finalize();
    memmap_finalize();

    // Setup bios checksum.
    BiosChecksum -= checksum((u8*)BUILD_BIOS_ADDR, BUILD_BIOS_SIZE);

    // Write protect bios memory.
    make_bios_readonly();

    // Invoke int 19 to start boot process.
    startBoot();
}
예제 #3
0
파일: main.c 프로젝트: skeezix/zikzak
int main(void) {

  system_cm3_setup();

  log_setup();
  queue_setup();

  init_usart1 ( 38400 ); // initialize USART1 @ 9600 baud
  init_usart2 ( 38400 );
  //USART_puts ( USART1, "Init usart1 complete! Hello World!\r\n" );
  USART_puts ( USART2, "Init usart2 complete! Hello World!\r\n" );

  fb_setup();

#ifdef VGA_DMA
  vga_setup ( VGA_USE_DMA );
#else
  vga_setup ( VGA_NO_DMA );
#endif

  fb_test_pattern ( fb_active, fbt_offset_squares );
  //fb_test_pattern ( fb_active, fbt_vlines );
  //fb_test_pattern ( fb_active, fbt_v1lines );
  //fb_test_pattern ( fb_active, fbt_onoff1 );

  while ( 1 ) {
    // weeeeee!

    // any work for us to do?
#if 1
    if ( vblank ) {

      if ( queueready() ) {
        command_queue_run();
      }

    }
#endif

    // update framebuffers
#if 0
    if ( vblank ) {
      unsigned char i = 0;
      fb_clone ( fb_2, fb_active );
      while ( vblank ) {
        __asm__("nop");
      }
      fb_test_pattern ( fb_2, i & 0x03 );
      i++;
    }
#endif

    // handle queued logs
#if 1
    if ( logready() ) {
      char *log;
      while ( ( log = logpull() ) ) {
        USART_puts ( USART2, log );
      }
    }
#endif

    __asm__("nop");
  }

} // main
예제 #4
0
파일: main.c 프로젝트: skeezix/zikzak
int main(void) {

  system_cm3_setup();

  log_setup();
  queue_setup();

  init_usart1 ( 38400 ); // initialize USART1 @ 9600 baud
  init_usart2 ( 38400 );
  //USART_puts ( USART1, "Init usart1 complete! Hello World!\r\n" );
  USART_puts ( USART2, "Init usart2 complete! Hello World!\r\n" );

  fb_setup();

#ifdef VGA_DMA
  vga_setup ( VGA_USE_DMA );
#else
  vga_setup ( VGA_NO_DMA );
#endif

#ifdef BUS_FRAMEBUFFER
  bus_setup();
#endif

  //fb_test_pattern ( fb_active, fbt_topbottom );
  fb_test_pattern ( fb_active, fbt_offset_squares );
  //fb_test_pattern ( fb_active, fbt_vlines );
  //fb_test_pattern ( fb_active, fbt_v1lines );
  //fb_test_pattern ( fb_active, fbt_onoff1 );
  //fb_test_pattern ( fb_active, fbt_spriteram );

  while ( 1 ) {
    // weeeeee!

    // any work for us to do?
#ifdef RUNMODE_COMMAND_SERIAL
    if ( vblank ) {

      if ( queueready() ) {
        command_queue_run();
      }

    }
#endif

#ifdef RUNMODE_FRAMEBUFFER_FOREVER
    if ( vblank ) {
      queueit ( "BD" );
      command_queue_run();
    }
#endif

    // update framebuffers
#if 0
    if ( vblank ) {
      unsigned char i = 0;
      fb_clone ( fb_2, fb_active );
      while ( vblank ) {
        __asm__("nop");
      }
      fb_test_pattern ( fb_2, i & 0x03 );
      i++;
    }
#endif

    // check for external RAM updates?
#ifdef zzBUS_FRAMEBUFFER
    static uint16_t _done = 0;
    _done++;
    if ( vblank && _done > 30 && _done < 40  ) {

      bus_grab_and_wait();

      uint32_t addr = 0x1C0000;
      uint8_t v;
      uint8_t i;
      char b [ 2 ];

      USART_puts_optional ( USART2, "+REM cart dump: " );

      for ( i = 0; i < 20; i++ ) {
        v = bus_perform_read ( addr );

        b [ 0 ] = v;
        b [ 1 ] = '\0';
        USART_puts_optional ( USART2, b );

        addr++;
      }

      USART_puts_optional ( USART2, "+++\n" );

      bus_release();

    }
#endif

    // handle queued logs
#if 0
    if ( logready() ) {
      char *log;
      while ( ( log = logpull() ) ) {
        USART_puts ( USART2, log );
      }
    }
#endif

    __asm__("nop");
  }

} // main