1 // components.cxx - definitions for this component library. -*- C++ -*-
3 // Copyright (C) 1999, 2000 Red Hat.
4 // This file is part of SID and is licensed under the GPL.
5 // See the file COPYING.SID for conditions for redistribution.
23 using sid::component_library;
24 using sid::COMPONENT_LIBRARY_MAGIC;
28 // ----------------------------------------------------------------------------
37 types.push_back("hw-memory-ram/rom-basic");
39 types.push_back("hw-memory-flash-at29");
40 for (const at29_flash_memory_type* ft = at29_flash_memory::types;
44 types.push_back(string("hw-memory-flash-at29") + ft->name);
47 types.push_back("hw-memory-flash-am29");
48 for (const am29_flash_memory_type* ft = am29_flash_memory::types;
52 types.push_back(string("hw-memory-flash-am29") + ft->name);
61 compMemoryCreate(const string& typeName)
63 // Protect against the constructors throwing exceptions
66 if (typeName == "hw-memory-ram/rom-basic")
67 return new ramrom_memory();
69 if (typeName == "hw-memory-flash-at29")
70 return new at29_flash_memory(512*1024, 512, 0x5B); // default: AT29C040
71 for (const at29_flash_memory_type* ft = at29_flash_memory::types;
75 string that_type = string("hw-memory-flash-at29") + ft->name;
76 if (that_type == typeName)
77 return new at29_flash_memory(ft->memory_size, ft->sector_size, ft->device_id);
80 if (typeName == "hw-memory-flash-am29")
82 // default: Am29LV040B
83 return new am29_flash_memory(512*1024, 64*1024, 0x4F);
85 for (const am29_flash_memory_type* ft = am29_flash_memory::types;
89 string that_type = string("hw-memory-flash-am29") + ft->name;
90 if (that_type == typeName)
91 return new am29_flash_memory(ft->memory_size, ft->sector_size, ft->device_id);
102 compMemoryDelete(component* c)
104 // generic_memory is a base class for all components that may have come from here
105 delete dynamic_cast<generic_memory*>(c);
111 extern const component_library mem_component_library;
113 const component_library mem_component_library DLLEXPORT =
115 COMPONENT_LIBRARY_MAGIC,
116 & compMemoryListTypes,