Example #1
0
void exception_init(void)
{
    write_c0_status(0x10000400);

    memcpy((void *)(A_K0BASE        ), except_common_entry, 0x20);
    memcpy((void *)(A_K0BASE + 0x180), except_common_entry, 0x20);
    memcpy((void *)(A_K0BASE + 0x200), except_common_entry, 0x20);

    __dcache_writeback_all();
    __icache_invalidate_all();
}
Example #2
0
static int boot_of(void)
{
    int fd, rc, len, i, checksum = 0;
    void (*kernel_entry)(int, void*, void*);

    printf("Mounting disk...");
    rc = disk_mount_all();
    if (rc <= 0)
        error(EDISK, rc, true);

    /* TODO: get this from the NAND flash instead of SD */
    fd = open("/ccpmp.bin", O_RDONLY);
    if(fd < 0)
        return EFILE_NOT_FOUND;

    lseek(fd, 4, SEEK_SET);
    rc = read(fd, (char*)&len, 4); /* CPU is LE */
    if(rc < 4)
        return EREAD_IMAGE_FAILED;

    len += 8;
    printf("Reading %d bytes...", len);

    lseek(fd, 0, SEEK_SET);
    rc = read(fd, (void*)0x80004000, len);
    if(rc < len)
        return EREAD_IMAGE_FAILED;

    close(fd);

    for(i=0; i<len; i++)
        checksum += ((unsigned char*)0x80004000)[i];

    *((unsigned int*)0x80004000) = checksum;

    printf("Starting the OF...");

    /* OF requires all clocks on */
    __cpm_start_all();

    disable_interrupt();
    __dcache_writeback_all();
    __icache_invalidate_all();

    for(i=8000; i>0; i--)
        asm volatile("nop\n");

    kernel_entry = (void*) 0x80004008;
    kernel_entry(0, "Jan 10 2008", "15:34:42"); /* Reversed from the SPL */

    return 0; /* Shouldn't happen */
}
Example #3
0
File: plug.c Project: 173210/ds2sdk
void ds2_plug_exit(void)
{
//printf("In run_plugin\n");
    disenable_nds();
//printf("In run_plugin 0\n");
    disable_irq_all();

    __dcache_writeback_all();
    __icache_invalidate_all();

    *(volatile unsigned short int*)cpld_ctr_addr = (1<<fifo_clear_bit);

    *(fpgaport*)cpld_ctr_addr = reset_main_nonds;
    *(fpgaport*)cpld_state_addr = BIT(8) | BIT(cpu_rtc_clk_enable_bit);
//printf("In run_plugin 1 %08x\n", *(fpgaport*)cpld_ctr_addr);
    _do_reset();
}
Example #4
0
File: init.c Project: 173210/ds2sdk
void ds2_init(void)
{
	pfunc *p;
	write_c0_status(0x10000400);

	memcpy((void *)A_K0BASE, except_common_entry, 0x20);
	memcpy((void *)(A_K0BASE + 0x180), except_common_entry, 0x20);
	memcpy((void *)(A_K0BASE + 0x200), except_common_entry, 0x20);

	__dcache_writeback_all();
	__icache_invalidate_all();

    init_perihery();
    InitExcept();
	_intc_init();

	detect_clock();

//	gpio_init();
//	serial_init();
    pm_init();
	//dgprintf("\n\nOS initial!\n");

//	OSInit();
    /* Invoke constroctor functions when needed. */
#if 1	
	for (p=&__CTOR_END__[-1]; p >= __CTOR_LIST__; p--)
	{
		printf("create class %08x\n",p);
		
		(*p)();
    }
	
	//dgprintf("Before main function\n");
#endif

	//Start system ticker
	_StartSysTimer();

	//enable global interrupt
	sti();
}