コード例 #1
0
ファイル: kernel.c プロジェクト: herb123456/DIY_Kernel
int kernelStart(struct multiboot_info *mboot_ptr){
	 
    
		kprintf("\n\n\n\n\n\n HW init ...\n");
     
		init_descriptor_tables();
		kprintf("\t\t IDT/GDT initialised...\n");
    
		init_sysClock(100);
		kprintf("\t\t CMOS timer initialised to 100hz...\n");
		
		
		u32int memsize = (mboot_ptr->mem_lower + mboot_ptr->mem_upper) * 1024;
		init_heap(end_address + 0x1000, memsize - end_address - 0x1000);
		//kprintf("\t\t end_address: %d \n", end_address);
		kprintf("\t\t Heap initialised...\n");
		
		
		init_keyboard();
		kprintf("\t\t PS/2 keyboard initialised...\n");
		
		init_system_timer();
		kprintf("\t\t timer initialised...\n");
		
		init_application();
		kprintf("\t\t application initialised...\n");
		
		enableInterrupt();
		while(1){}	
		return 0;
}
コード例 #2
0
ファイル: bootloader.c プロジェクト: korena/car-dashboard
int
start_linux(void)
{
    void (*theKernel)(uint32_t zero, uint32_t arch, uint32_t *params);
    uint32_t i = 0, j = 0,ret;
    load_addr = (uint32_t) ZIMAGE_LOAD_ADDRESS;
    uint32_t *exec_at =  ZIMAGE_LOAD_ADDRESS;
    uint32_t *parm_at = (uint32_t *)( DRAM_BASE + 0x100) ;  // 256 bytes away from the base address of DRAM
    uint32_t machine_type;

   // debug_print("about to copy linux image to load address: ");
   //     uart_print_address(exec_at);
   //	ret = load_image((uint32_t)ZIMAGE_START_BLOCK_NUMBER,(uint32_t*)exec_at,(uint16_t)2666);    /* copy image into RAM */

   // debug_print("done copying linux image ...\n\r");

//    debug_print("about to copy ramdisk image ...");

//    load_image((uint32_t*) INITRD_LOAD_ADDRESS, INITRD_LOAD_END_ADDRESS);/* copy initial ramdisk image into RAM */

//    debug_print("done copying ramdisk image ...");


    theKernel = (void (*)(uint32_t, uint32_t, uint32_t*))exec_at; /* set the kernel address */
    
	
	

	print_format("Setting up timers next ...\n\r");
	init_system_timer();	
	init_timer();
//	uint32_t start_time = get_timer(0);
//
//	while(1){
//		print_format("time difference in ms is %d\n\r",start_time - get_timer(0));
//		udelay(1000000);
//	}
	print_format("fetching kernel ... \n\r");
	net_loop(TFTPGET);
//	net_loop(ARP);
	print_format("kernel loaded to RAM ...\n\r");
    	debug_print("setting up ATAGS ...\n\r");

    	setup_tags(parm_at);                    /* sets up parameters */

    	machine_type = 3466;	              /* get machine type */

	debug_print("jumping to the kernel ... brace yourself!\n\r\0");
 
	asm("mrc p15, 0, r1, c1, c0, 0"); /* Read Control Register configuration data*/
	asm("bic r1, r1, #(0x1 << 12)");  /* Disable I Cache*/
	asm("bic r1, r1, #(0x1 << 2)");   /* Disable D Cache*/
	asm("mcr p15, 0, r1, c1, c0, 0"); /* Write Control Register configuration data*/

	theKernel(0, machine_type, parm_at);    /* jump to kernel with registers set */

//	uint32_t start_time = get_timer(0);

//	while(1){
//		print_format("time difference in ms is %d\n\r",get_timer(start_time));
//		udelay(1000000);
//	}

    return 0;
}
コード例 #3
0
ファイル: bios.c プロジェクト: kelihlodversson/emutos
static void bios_init(void)
{
    KDEBUG(("bios_init()\n"));

    /* initialize Native Features, if available
     * do it as soon as possible so that kprintf can make use of them
     */
#if DETECT_NATIVE_FEATURES
    KDEBUG(("natfeat_init()\n"));
    natfeat_init();
#endif
#if STONX_NATIVE_PRINT
    KDEBUG(("stonx_kprintf_init()\n"));
    stonx_kprintf_init();
#endif
#if CONF_WITH_UAE
    KDEBUG(("amiga_uaelib_init()\n"));
    amiga_uaelib_init();
#endif

    /* Initialize the processor */
    KDEBUG(("processor_init()\n"));
    processor_init();   /* Set CPU type, longframe and FPU type */
    KDEBUG(("vecs_init()\n"));
    vecs_init();        /* setup all exception vectors (above) */
    KDEBUG(("init_delay()\n"));
    init_delay();       /* set 'reasonable' default values for delay */

    /* Detect optional hardware (video, sound, etc.) */
    KDEBUG(("machine_detect()\n"));
    machine_detect();   /* detect hardware */
    KDEBUG(("machine_init()\n"));
    machine_init();     /* initialise machine-specific stuff */

    /* Initialize the screen */
    KDEBUG(("screen_init()\n"));
    screen_init();      /* detect monitor type, ... */

    /* Initialize the BIOS memory management */
    KDEBUG(("bmem_init()\n"));
    bmem_init();        /* this must be done after screen_init() */

    KDEBUG(("cookie_init()\n"));
    cookie_init();      /* sets a cookie jar */
    KDEBUG(("fill_cookie_jar()\n"));
    fill_cookie_jar();  /* detect hardware features and fill the cookie jar */

    /* Set up the BIOS console output */
    KDEBUG(("linea_init()\n"));
    linea_init();       /* initialize screen related line-a variables */
    font_init();        /* initialize font ring (requires cookie_akp) */
    font_set_default(-1);/* set default font */
    vt52_init();        /* initialize the vt52 console */

    /* Now kcprintf() will also send debug info to the screen */
    KDEBUG(("after vt52_init()\n"));

    /* misc. variables */
    dumpflg = -1;
    sysbase = (LONG) os_entry;
    savptr = (LONG) trap_save_area;
    etv_timer = (void(*)(int)) just_rts;
    etv_critic = default_etv_critic;
    etv_term = just_rts;

    /* setup VBL queue */
    nvbls = 8;
    vblqueue = vbl_list;
    {
        int i;
        for(i = 0 ; i < 8 ; i++) {
            vbl_list[i] = 0;
        }
    }

#if CONF_WITH_MFP
    KDEBUG(("mfp_init()\n"));
    mfp_init();
#endif

#if CONF_WITH_TT_MFP
    if (has_tt_mfp)
    {
        KDEBUG(("tt_mfp_init()\n"));
        tt_mfp_init();
    }
#endif

    /* Initialize the system 200 Hz timer */
    KDEBUG(("init_system_timer()\n"));
    init_system_timer();

    /* Initialize the RS-232 port(s) */
    KDEBUG(("chardev_init()\n"));
    chardev_init();     /* Initialize low-memory bios vectors */
    boot_status |= CHARDEV_AVAILABLE;   /* track progress */
    KDEBUG(("init_serport()\n"));
    init_serport();
    boot_status |= RS232_AVAILABLE;     /* track progress */
#if CONF_WITH_SCC
    if (has_scc)
        boot_status |= SCC_AVAILABLE;   /* track progress */
#endif

    /* The sound init must be done before allowing MFC interrupts,
     * because of dosound stuff in the timer C interrupt routine.
     */
#if CONF_WITH_DMASOUND
    KDEBUG(("dmasound_init()\n"));
    dmasound_init();
#endif
    KDEBUG(("snd_init()\n"));
    snd_init();         /* Reset Soundchip, deselect floppies */

    /* Init the two ACIA devices (MIDI and KBD). The three actions below can
     * be done in any order provided they happen before allowing MFP
     * interrupts.
     */
    KDEBUG(("kbd_init()\n"));
    kbd_init();         /* init keyboard, disable mouse and joystick */
    KDEBUG(("midi_init()\n"));
    midi_init();        /* init MIDI acia so that kbd acia irq works */
    KDEBUG(("init_acia_vecs()\n"));
    init_acia_vecs();   /* Init the ACIA interrupt vector and related stuff */
    KDEBUG(("after init_acia_vecs()\n"));
    boot_status |= MIDI_AVAILABLE;  /* track progress */

    /* Now we can enable the interrupts.
     * We need a timer for DMA timeouts in floppy and harddisk initialisation.
     * The VBL processing will be enabled later with the vblsem semaphore.
     */
#if CONF_WITH_ATARI_VIDEO
    /* Keep the HBL disabled */
    set_sr(0x2300);
#else
    set_sr(0x2000);
#endif

    KDEBUG(("calibrate_delay()\n"));
    calibrate_delay();  /* determine values for delay() function */
                        /*  - requires interrupts to be enabled  */
    KDEBUG(("blkdev_init()\n"));
    blkdev_init();      /* floppy and harddisk initialisation */
    KDEBUG(("after blkdev_init()\n"));

    /* initialize BIOS components */

    KDEBUG(("parport_init()\n"));
    parport_init();     /* parallel port */
    //mouse_init();     /* init mouse driver */
    KDEBUG(("clock_init()\n"));
    clock_init();       /* init clock */
    KDEBUG(("after clock_init()\n"));

#if CONF_WITH_NLS
    KDEBUG(("nls_init()\n"));
    nls_init();         /* init native language support */
    nls_set_lang(get_lang_name());
#endif

    /* set start of user interface */
#if WITH_AES
    exec_os = ui_start;
#elif WITH_CLI
    exec_os = coma_start;
#else
    exec_os = NULL;
#endif

    KDEBUG(("osinit()\n"));
    osinit();                   /* initialize BDOS */
    KDEBUG(("after osinit()\n"));
    boot_status |= DOS_AVAILABLE;   /* track progress */

    /* Enable VBL processing */
    vblsem = 1;

#if CONF_WITH_CARTRIDGE
    {
        WORD save_hz = v_hz_rez, save_vt = v_vt_rez, save_pl = v_planes;

        /* Run all boot applications from the application cartridge.
         * Beware: Hatari features a special cartridge which is used
         * for GEMDOS drive emulation. It will hack drvbits and hook Pexec().
         * It will also hack Line A variables to enable extended VDI video modes.
         */
        KDEBUG(("run_cartridge_applications(3)\n"));
        run_cartridge_applications(3); /* Type "Execute prior to bootdisk" */
        KDEBUG(("after run_cartridge_applications()\n"));

        if ((v_hz_rez != save_hz) || (v_vt_rez != save_vt) || (v_planes != save_pl))
        {
            set_rez_hacked();
            font_set_default(-1);   /* set default font */
            vt52_init();            /* initialize the vt52 console */
        }
    }
#endif

#if CONF_WITH_ALT_RAM

#if CONF_WITH_FASTRAM
    /* add TT-RAM that was detected in memory.S */
    if (ramtop != NULL)
    {
        KDEBUG(("xmaddalt()\n"));
        xmaddalt(FASTRAM_START, ramtop - FASTRAM_START);
    }
#endif

#if CONF_WITH_MONSTER
    /* Add MonSTer alt-RAM detected in machine.c */
    if (has_monster)
    {
        /* Dummy read from MonSTer register to initiate write sequence. */
        unsigned short monster_reg = *(volatile unsigned short *)MONSTER_REG;

        /* Only enable 6Mb when on a Mega STE due to address conflict with
           VME bus. Todo: This should be made configurable. */
        if (has_vme)
            monster_reg = 6;
        else
            monster_reg = 8;

        /* Register write sequence: read - write - write */
        *(volatile unsigned short *)MONSTER_REG = monster_reg;
        *(volatile unsigned short *)MONSTER_REG = monster_reg;
        KDEBUG(("xmaddalt()\n"));
        xmaddalt((UBYTE *)0x400000L, monster_reg*0x100000L);
    }
#endif

#ifdef MACHINE_AMIGA
    KDEBUG(("amiga_add_alt_ram()\n"));
    amiga_add_alt_ram();
#endif

#endif /* CONF_WITH_ALT_RAM */

    KDEBUG(("bios_init() end\n"));
}