Example #1
0
TEST_F(MemoryTest, DecreaseRemainingSpace) {
    decrease_remaining_space(test_mmr, MAX_ALLOCATABLE_SPACE);
    EXPECT_EQ(0, remaining_space(test_mmr));

    test_mmr = configure_memory(addr, TOTAL_SPACE);
    decrease_remaining_space(test_mmr, MAX_ALLOCATABLE_SPACE / 2);
    EXPECT_EQ(MAX_ALLOCATABLE_SPACE / 2, remaining_space(test_mmr));

    decrease_remaining_space(test_mmr, MAX_ALLOCATABLE_SPACE / 2);
    EXPECT_EQ(0, remaining_space(test_mmr));
}
Example #2
0
  virtual void SetUp() {
    // Code here will be called immediately after the constructor (right
    // before each test).
    RESET_FAKE(disable_interrupts);
    RESET_FAKE(enable_interrupts);
    RESET_FAKE(getCurrentPID);
    FFF_RESET_HISTORY();

    addr = malloc(TOTAL_SPACE);
    if (addr == NULL) {
        printf("SetUp could not allocate memory\n");
        exit(1);
    }
    test_mmr = configure_memory(addr, TOTAL_SPACE);
  }
Example #3
0
void fs_uae_configure_hardware(void)
{
    configure_cpu();
    configure_memory();
}
Example #4
0
TEST_F(MemoryTest, ConfigureMemory) {
    test_mmr = configure_memory(addr, TOTAL_SPACE);
    EXPECT_EQ(addr, test_mmr);
    EXPECT_EQ((uintptr_t) addr + TOTAL_SPACE, test_mmr->end_of_memory);
}
Example #5
0
static int parse_slot_config(int slot,
			     const unsigned char *buf,
			     struct eeprom_eisa_slot_info *es, 
			     struct resource *io_parent,
			     struct resource *mem_parent)
{
	int res=0;
	int function_len;
	unsigned int pos=0;
	unsigned int maxlen;
	int num_func=0;
	u_int8_t flags;
	int p0;
	
	char *board;
	int id_string_used=0;
	
	if (NULL == (board = kmalloc(8, GFP_KERNEL))) {
		return -1;
	}
	print_eisa_id(board, es->eisa_slot_id);
	printk(KERN_INFO "EISA slot %d: %s %s ", 
	       slot, board, es->flags&HPEE_FLAG_BOARD_IS_ISA ? "ISA" : "EISA");
	
	maxlen = es->config_data_length < HPEE_MAX_LENGTH ?
			 es->config_data_length : HPEE_MAX_LENGTH;
	while ((pos < maxlen) && (num_func <= es->num_functions)) {
		pos+=configure_function(buf+pos, &function_len); 
		
		if (!function_len) {
			break;
		}
		num_func++;
		p0 = pos;
		pos += configure_choise(buf+pos, &flags);

		if (flags & HPEE_FUNCTION_INFO_F_DISABLED) {
			/* function disabled, skip silently */
			pos = p0 + function_len;
			continue;
		}
		if (flags & HPEE_FUNCTION_INFO_CFG_FREE_FORM) {
			/* I have no idea how to handle this */
			printk("function %d have free-form confgiuration, skipping ",
				num_func);
			pos = p0 + function_len;
			continue;
		}

		/* the ordering of the sections need
		 * more investigation.
		 * Currently I think that memory comaed before IRQ
		 * I assume the order is LSB to MSB in the 
		 * info flags 
		 * eg type, memory, irq, dma, port, HPEE_PORT_init 
		 */

		if (flags & HPEE_FUNCTION_INFO_HAVE_TYPE) {
			pos += configure_type_string(buf+pos);
		}
		
		if (flags & HPEE_FUNCTION_INFO_HAVE_MEMORY) {
			id_string_used=1;
			pos += configure_memory(buf+pos, mem_parent, board);
		} 
		
		if (flags & HPEE_FUNCTION_INFO_HAVE_IRQ) {
			pos += configure_irq(buf+pos);
		} 
		
		if (flags & HPEE_FUNCTION_INFO_HAVE_DMA) {
			pos += configure_dma(buf+pos);
		} 
		
		if (flags & HPEE_FUNCTION_INFO_HAVE_PORT) {
			id_string_used=1;
			pos += configure_port(buf+pos, io_parent, board);
		} 
		
		if (flags &  HPEE_FUNCTION_INFO_HAVE_PORT_INIT) {
			pos += configure_port_init(buf+pos);
		}
		
		if (p0 + function_len < pos) {
			printk("\n" KERN_ERR "eisa_enumerator: function %d length mis-match "
			       "got %d, expected %d\n",
			       num_func, pos-p0, function_len);
			res=-1;
			break;
		}
		pos = p0 + function_len;
	}
	printk("\n");
	if (!id_string_used) {
		kfree(board);
	}
	
	if (pos != es->config_data_length) {
		printk(KERN_ERR "eisa_enumerator: config data length mis-match got %d, expected %d\n",
			pos, es->config_data_length);
		res=-1;
	}
	
	if (num_func != es->num_functions) {
		printk(KERN_ERR "eisa_enumerator: number of functions mis-match got %d, expected %d\n",
			num_func, es->num_functions);
		res=-2;
	}
	
	return res;
	
}
Example #6
0
void fs_uae_configure_amiga_hardware() {
    amiga_config *c = g_fs_uae_amiga_configs + g_fs_uae_amiga_config;
    char *path;

    fs_emu_log("fs_uae_configure_amiga_hardware\n");

    fs_uae_load_rom_files(fs_uae_kickstarts_dir());

#ifdef NEW_ACCURACY_SYSTEM
    g_accuracy = 1;
#endif
    fs_emu_log("configuring \"%s\", accuracy=%d\n", c->name, g_accuracy);

    amiga_quickstart(c->quickstart_model, c->quickstart_config, g_accuracy);
    amiga_set_option("cachesize", "0");

    if (c->cpu_model) {
        amiga_set_option("cpu_model", c->cpu_model);
    }
    if (c->z3mem_size) {
        amiga_set_int_option("z3mem_size", c->z3mem_size);
    }
    if (c->cpu_32bit_addressing) {
        amiga_set_option("cpu_24bit_addressing", "false");
    }
    if (c->fast) {
        amiga_set_option("cpu_speed", "max");
        amiga_set_option("blitter_cycle_exact", "false");
        amiga_set_option("cpu_cycle_exact", "false");

        amiga_set_option("cpu_compatible", "false");
        amiga_set_option("immediate_blits", "true");


    }

    //if (g_fs_uae_fastest_possible) {
        amiga_set_cpu_idle(2);
    //}

    if (g_fs_uae_ntsc_mode) {
        // FIXME: ciiatod on some Amiga models?
        amiga_set_option("ntsc", "true");
    }

    path = fs_config_get_string("kickstart_file");
    if (path) {
        path = fs_uae_expand_path_and_free(path);
        path = fs_uae_resolve_path_and_free(path, FS_UAE_ROM_PATHS);
        amiga_set_option("kickstart_rom_file", path);
        free(path);
    }
    path = fs_config_get_string("kickstart_ext_file");
    if (path) {
        path = fs_uae_expand_path_and_free(path);
        path = fs_uae_resolve_path_and_free(path, FS_UAE_ROM_PATHS);
        amiga_set_option("kickstart_ext_rom_file", path);
        free(path);
    }

    configure_memory(c);

    if (fs_config_get_boolean("bsdsocket_library") == 1) {
        amiga_set_option("bsdsocket_emu", "yes");
    }

    amiga_enable_serial_port();
    configure_accuracy(c);

    /*
    if (g_fs_uae_amiga_model == MODEL_A500) {
    	if (slow_memory || fast_memory || chip_memory > 512) {
    		fs_log("using A500 and memory expansions, "
    				"enabling real-time clock");
    		amiga_set_option("rtc", "MSM6242B");
    	}
    }
    */

    /*
    char **keys = g_key_file_get_keys(g_fs_uae_config, "uae", NULL, NULL);
    if (keys) {
        for (char **key = keys; *key; key++) {
            char *value = g_key_file_get_string(g_fs_uae_config, "uae",
                    *key, NULL);
            if (value != NULL) {
                amiga_set_option(*key, value);
                free(value);
            }
        }
        g_strfreev(keys);
    }
    */
}