Пример #1
0
/* init2():
 */
void
init2(void)
{
#if INCLUDE_FLASH | INCLUDE_TFS
    int rc = 0;
#endif

#if INCLUDE_FBI
    if(StateOfMonitor == INITIALIZE) {
        fbdev_init();    /* Initialize the frame-buffer device */
    }
#endif

#if INCLUDE_FLASH
    if(StateOfMonitor == INITIALIZE) {
        rc = FlashInit();    /* Init flashop data structures and (possibly) */
    }
    /* the relocatable functions.  This MUST be */
#endif                      /* done prior to turning on cache!!! */

    cacheInit();        /* Initialize cache. */

#if INCLUDE_ETHERNET
    enreset();          /* Clear the ethernet interface. */
#endif

#if INCLUDE_TFS
    if(rc != -1) {      /* Start up TFS as long as flash */
        tfsstartup();    /* initialization didn't fail. */
    }
#endif
}
Пример #2
0
void MainWindow::on_pushButton_6_clicked()
{

    if (cacheSize > 0 && cacheLine > 0)
    {
        if (existCache != true)
        {
            QStringList list;
            this->ui->tableWidget->setColumnCount(2 + cacheLine);
            if (cacheLine == 2)
            {
                list << "Tag" << "00" << "01" << "DirtyBit";
            }
            else if (cacheLine == 4)
            {
                list << "Tag" << "00" << "01" << "10" << "11" << "DirtyBit";
            }
            else if (cacheLine == 8)
            {
                list << "Tag";
                QString num;
                for (int i =0; i < 8; i ++)
                {
                    num = QString::number(i, 2);
                    num = num.rightJustified(3,'0');
                    list << (num);
                }
                list << "DirtyBit";
            }
            this->ui->tableWidget->setHorizontalHeaderLabels(list);
            this->ui->tableWidget->resizeColumnsToContents();
            this->ui->tableWidget->setRowCount(cacheSize/cacheLine );
        }
        existCache = true;
        emit cacheInit(cacheSize, cacheLine);
    }
    else
    {
        msgRcv("Error: Cache Size/Line not specified");
    }
}
Пример #3
0
Файл: sys.c Проект: aosm/boot
static int
openi(int n, struct iob *io)
{
	struct dinode *dp;
	int cc;
#if ICACHE
	struct icommon *ip;
	
	if (icache == 0) {
	    icache = cacheInit(ICACHE_SIZE, sizeof(struct icommon));
	}
#endif ICACHE
	io->i_offset = 0;
	io->i_bn = fsbtodb(io->i_fs, itod(io->i_fs, n)) + io->i_boff;
	io->i_cc = io->i_fs->fs_bsize;
	io->i_ma = io->i_buf;

#if ICACHE
	if (cacheFind(icache, n, 0, (char **)&ip) == 1) {
		io->i_ino.i_ic = *ip;
		cc = 0;
	} else {
#endif ICACHE
	    cc = devread(io);
	    dp = (struct dinode *)io->i_buf;
#if	BIG_ENDIAN_FS
	    byte_swap_inode_in(&dp[itoo(io->i_fs, n)].di_ic, &io->i_ino.i_ic);
#else
	    io->i_ino.i_ic = dp[itoo(io->i_fs, n)].di_ic;
#endif	BIG_ENDIAN_FS
#if ICACHE
	    *ip = io->i_ino.i_ic;
	}
#endif ICACHE
	io->i_ino.i_number = n;
	return (cc);
}
Пример #4
0
ARMV5::ARMV5(sc_module_name name, uint32_t addr, bool using_gdb, unsigned int gdb_port): sc_module(name)
{
    this->core_id = 0;
    cp15.c0_idcode = 0x41069265;
    cp15.c0_cachetype = 0x1dd20d2;
    cp15.c0_cachetype = 0x1d112152;

    gdb = 0;
    this->using_gdb = using_gdb;
    this->gdb_port = gdb_port;
    gdb_init = false;
    using_prog = false;

    bkptRemove();   // clear all break points
    watchRemove();  // clear all watch points
    rfInit(addr);
    cpInit();
    cacheInit();
    delay = 0;
    mmu_enable = false;
    icache_enable = false;
    dcache_enable = false;
    vectorHi = false;

    /* start to simulate */
    SC_THREAD(run);
    sensitive << clk.pos();
    //dont_initialize();

    SC_METHOD(shared_event_listener);
    sensitive << ARMV5::shared_event;

    SC_METHOD(irq_n_listener);
    sensitive << irq_n.neg();

}
Пример #5
0
Файл: sys.c Проект: aosm/boot
/*
 * get next entry in a directory.
 */
struct direct *
readdir(struct dirstuff *dirp)
{
	struct direct *dp;
	register struct iob *io;
	daddr_t lbn, d;
	int off;
#if DCACHE
	char *bp;
	int dirblkno;

	if (dcache == 0)
		dcache = cacheInit(DCACHE_SIZE, DIRBLKSIZ);
#endif DCACHE
	io = dirp->io;
	for(;;)
	{
		if (dirp->loc >= io->i_ino.i_size)
			return (NULL);
		off = blkoff(io->i_fs, dirp->loc);
		lbn = lblkno(io->i_fs, dirp->loc);

#if DCACHE
		dirblkno = dirp->loc / DIRBLKSIZ;
		if (cacheFind(dcache, io->i_ino.i_number, dirblkno, &bp)) {
		    dp = (struct direct *)(bp + (dirp->loc % DIRBLKSIZ));
		} else
#else DCACHE
		if (io->dirbuf_blkno != lbn)
#endif DCACHE
		{
		    if((d = sbmap(io, lbn)) == 0)
			    return NULL;
		    io->i_bn = fsbtodb(io->i_fs, d) + io->i_boff;
		    io->i_ma = io->i_buf;
		    io->i_cc = blksize(io->i_fs, &io->i_ino, lbn);
		
		    if (devread(io) < 0)
		    {
#if	SYS_MESSAGES
			    error("bn %d: directory read error\n",
				    io->i_bn);
#endif
			    return (NULL);
		    }
#if	BIG_ENDIAN_FS
		    byte_swap_dir_block_in(io->i_buf, io->i_cc);
#endif	BIG_ENDIAN_FS
#if DCACHE
		    bcopy(io->i_buf + dirblkno * DIRBLKSIZ, bp, DIRBLKSIZ);
		    dp = (struct direct *)(io->i_buf + off);
#endif
		}
#if !DCACHE
		dp = (struct direct *)(io->i_buf + off);
#endif
		dirp->loc += dp->d_reclen;

		if (dp->d_ino != 0) return (dp);
	}
}
Пример #6
0
int _start(int argc, char **argv)
{
	int 	i;
	char	*input;
	int		cacheSize=3;
	ps2time tm;
	t_shddInfo *hddInfo;

	printStartup();
	// decode MBR Magic
	for(i=0;i!=0x20;i++)
		mbrMagic[i]^='x';

	if((input=strrchr(argv[0], '/')))
		input++;
	else
		input=argv[0];

	argc--; argv++;
	while(argc)
	{
		if(argv[0][0] != '-') 
			break;
		if(strcmp("-o", argv[0])==0){
			argc--; argv++;
			if(!argc)
				return inputError(input);
			i=strtol(argv[0], 0, 10);
			if(i-1<32)
				maxOpen=i;
		}
		else if(strcmp("-n", argv[0])==0){
			argc--; argv++;
			if(!argc)
				return inputError(input);
			i=strtol(*argv, 0, 10);
			if(cacheSize<i)
				cacheSize=i;
		}
		argc--; argv++;
	}

	printf("ps2hdd: max open = %ld, %d buffers\n", maxOpen, cacheSize);
	getPs2Time(&tm);
	printf("ps2hdd: %02d:%02d:%02d %02d/%02d/%d\n",
		tm.hour, tm.min, tm.sec, tm.month, tm.day, tm.year);
	for(i=0;i < 2;i++)
	{
		if(!(hddInfo=atadInit((u16)i))){
			printf("ps2hdd: Error: ata initialization failed.\n");
			return 0;
		}
		if(hddInfo->exists!=0 && hddInfo->has_packet==0){
				hddDeviceBuf[i].status--;
				hddDeviceBuf[i].totalLBA=hddInfo->total_sectors;
				hddDeviceBuf[i].partitionMaxSize=apaGetPartitionMax(hddInfo->total_sectors);
				if(unlockDrive(i)==0)
					hddDeviceBuf[i].status--;
				printf("ps2hdd: disk%d: 0x%08lx sectors, max 0x%08lx\n", i,
					hddDeviceBuf[i].totalLBA, hddDeviceBuf[i].partitionMaxSize);
		}
	}
	fileSlots=allocMem(maxOpen*sizeof(hdd_file_slot_t));
	if(fileSlots)
		memset(fileSlots, 0, maxOpen*sizeof(hdd_file_slot_t));

	cacheInit(cacheSize);
	for(i=0;i < 2;i++)
	{
		if(hddDeviceBuf[i].status<2){
			if(journalResetore(i)!=0)
				return 1;
			if(apaGetFormat(i, (int *)&hddDeviceBuf[i].format))
				hddDeviceBuf[i].status--;
			printf("ps2hdd: drive status %ld, format version %08lx\n",
				hddDeviceBuf[i].status, hddDeviceBuf[i].format);
		}
	}
	DelDrv("hdd");
	if(AddDrv(&hddFioDev)==0)
	{
		printf("ps2hdd: driver start.\n");
		return 0;
	}
	return 1;
}