Skip to content

Commit 74b3292

Browse files
authored
misc/cv1k.cpp, misc/nexus3d.cpp: Migrated to use newer machine/nandflash.cpp Flash memory emulation. (#11708)
* machine/nandflash.cpp: Only reset page address on read or program command. * machine/nandflash.cpp: Added Samsung K9F1G08U0M and K9F2G08U0M. * Removed now-unused machine/serflash.cpp.
1 parent 65ec454 commit 74b3292

File tree

7 files changed

+106
-640
lines changed

7 files changed

+106
-640
lines changed

scripts/src/machine.lua

-12
Original file line numberDiff line numberDiff line change
@@ -3311,18 +3311,6 @@ if (MACHINES["SENSORBOARD"]~=null) then
33113311
}
33123312
end
33133313

3314-
---------------------------------------------------
3315-
--
3316-
--@src/devices/machine/serflash.h,MACHINES["SERFLASH"] = true
3317-
---------------------------------------------------
3318-
3319-
if (MACHINES["SERFLASH"]~=null) then
3320-
files {
3321-
MAME_DIR .. "src/devices/machine/serflash.cpp",
3322-
MAME_DIR .. "src/devices/machine/serflash.h",
3323-
}
3324-
end
3325-
33263314
---------------------------------------------------
33273315
--
33283316
--@src/devices/machine/smc91c9x.h,MACHINES["SMC91C9X"] = true

src/devices/machine/nandflash.cpp

+40-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ DEFINE_DEVICE_TYPE(SAMSUNG_K9F5608U0DJ, samsung_k9f5608u0dj_device, "samsung_k9f
2525
DEFINE_DEVICE_TYPE(SAMSUNG_K9F5608U0B, samsung_k9f5608u0b_device, "samsung_k9f5608u0b", "Samsung K9F5608U0B")
2626
DEFINE_DEVICE_TYPE(SAMSUNG_K9F2808U0B, samsung_k9f2808u0b_device, "samsung_k9f2808u0b", "Samsung K9F2808U0B")
2727
DEFINE_DEVICE_TYPE(SAMSUNG_K9F1G08U0B, samsung_k9f1g08u0b_device, "samsung_k9f1g08u0b", "Samsung K9F1G08U0B")
28+
DEFINE_DEVICE_TYPE(SAMSUNG_K9F1G08U0M, samsung_k9f1g08u0m_device, "samsung_k9f1g08u0m", "Samsung K9F1G08U0M")
2829
DEFINE_DEVICE_TYPE(SAMSUNG_K9LAG08U0M, samsung_k9lag08u0m_device, "samsung_k9lag08u0m", "Samsung K9LAG08U0M")
30+
DEFINE_DEVICE_TYPE(SAMSUNG_K9F2G08U0M, samsung_k9f2g08u0m_device, "samsung_k9f2g08u0m", "Samsung K9F2G08U0M")
2931

3032
nand_device::nand_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
3133
: nand_device(mconfig, NAND, tag, owner, clock)
@@ -128,6 +130,23 @@ samsung_k9f1g08u0b_device::samsung_k9f1g08u0b_device(const machine_config &mconf
128130
m_sequential_row_read = 0;
129131
}
130132

133+
samsung_k9f1g08u0m_device::samsung_k9f1g08u0m_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
134+
: nand_device(mconfig, SAMSUNG_K9F1G08U0M, tag, owner, clock)
135+
{
136+
m_id_len = 4;
137+
m_id[0] = 0xec;
138+
m_id[1] = 0xf1;
139+
m_id[2] = 0x00;
140+
m_id[3] = 0x15;
141+
m_page_data_size = 2048;
142+
m_page_total_size = 2048 + 64;
143+
m_log2_pages_per_block = compute_log2(64);
144+
m_num_pages = 64 * 1024;
145+
m_col_address_cycles = 2;
146+
m_row_address_cycles = 2;
147+
m_sequential_row_read = 0;
148+
}
149+
131150
samsung_k9lag08u0m_device::samsung_k9lag08u0m_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
132151
: nand_device(mconfig, SAMSUNG_K9LAG08U0M, tag, owner, clock)
133152
{
@@ -146,6 +165,23 @@ samsung_k9lag08u0m_device::samsung_k9lag08u0m_device(const machine_config &mconf
146165
m_sequential_row_read = 0;
147166
}
148167

168+
samsung_k9f2g08u0m_device::samsung_k9f2g08u0m_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
169+
: nand_device(mconfig, SAMSUNG_K9F2G08U0M, tag, owner, clock)
170+
{
171+
m_id_len = 4;
172+
m_id[0] = 0xec;
173+
m_id[1] = 0xda;
174+
m_id[2] = 0x00;
175+
m_id[3] = 0x15;
176+
m_page_data_size = 2048;
177+
m_page_total_size = 2048 + 64;
178+
m_log2_pages_per_block = compute_log2(64);
179+
m_num_pages = 128 * 1024;
180+
m_col_address_cycles = 2;
181+
m_row_address_cycles = 3;
182+
m_sequential_row_read = 0;
183+
}
184+
149185
void nand_device::device_start()
150186
{
151187
m_data_uid_ptr = nullptr; // smartmed cruft
@@ -242,7 +278,6 @@ void nand_device::command_w(uint8_t data)
242278
case 0x00: // Read (1st cycle)
243279
m_mode = SM_M_READ;
244280
m_pointer_mode = SM_PM_A;
245-
m_page_addr = 0;
246281
m_addr_load_ptr = 0;
247282
break;
248283
case 0x01:
@@ -255,7 +290,6 @@ void nand_device::command_w(uint8_t data)
255290
{
256291
m_mode = SM_M_READ;
257292
m_pointer_mode = SM_PM_B;
258-
m_page_addr = 0;
259293
m_addr_load_ptr = 0;
260294
}
261295
break;
@@ -269,13 +303,11 @@ void nand_device::command_w(uint8_t data)
269303
{
270304
m_mode = SM_M_READ;
271305
m_pointer_mode = SM_PM_C;
272-
m_page_addr = 0;
273306
m_addr_load_ptr = 0;
274307
}
275308
break;
276309
case 0x80: // Page Program (1st cycle)
277310
m_mode = SM_M_PROGRAM;
278-
m_page_addr = 0;
279311
m_addr_load_ptr = 0;
280312
m_program_byte_count = 0;
281313
memset(m_pagereg.get(), 0xff, m_page_total_size);
@@ -432,6 +464,10 @@ void nand_device::address_w(uint8_t data)
432464
break;
433465
case SM_M_READ:
434466
case SM_M_PROGRAM:
467+
if (m_addr_load_ptr == 0)
468+
{
469+
m_page_addr = 0;
470+
}
435471
if ((m_addr_load_ptr == 0) && (m_col_address_cycles == 1))
436472
{
437473
switch (m_pointer_mode)

src/devices/machine/nandflash.h

+14
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,33 @@ class samsung_k9f1g08u0b_device : public nand_device
130130
samsung_k9f1g08u0b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
131131
};
132132

133+
class samsung_k9f1g08u0m_device : public nand_device
134+
{
135+
public:
136+
samsung_k9f1g08u0m_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
137+
};
138+
133139
class samsung_k9lag08u0m_device : public nand_device
134140
{
135141
public:
136142
samsung_k9lag08u0m_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
137143
};
138144

145+
class samsung_k9f2g08u0m_device : public nand_device
146+
{
147+
public:
148+
samsung_k9f2g08u0m_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
149+
};
150+
139151
// device type definition
140152
DECLARE_DEVICE_TYPE(NAND, nand_device)
141153
DECLARE_DEVICE_TYPE(SAMSUNG_K9F5608U0D, samsung_k9f5608u0d_device)
142154
DECLARE_DEVICE_TYPE(SAMSUNG_K9F5608U0DJ, samsung_k9f5608u0dj_device)
143155
DECLARE_DEVICE_TYPE(SAMSUNG_K9F5608U0B, samsung_k9f5608u0b_device)
144156
DECLARE_DEVICE_TYPE(SAMSUNG_K9F2808U0B, samsung_k9f2808u0b_device)
145157
DECLARE_DEVICE_TYPE(SAMSUNG_K9F1G08U0B, samsung_k9f1g08u0b_device)
158+
DECLARE_DEVICE_TYPE(SAMSUNG_K9F1G08U0M, samsung_k9f1g08u0m_device)
146159
DECLARE_DEVICE_TYPE(SAMSUNG_K9LAG08U0M, samsung_k9lag08u0m_device)
160+
DECLARE_DEVICE_TYPE(SAMSUNG_K9F2G08U0M, samsung_k9f2g08u0m_device)
147161

148162
#endif // MAME_MACHINE_NANDFLASH_H

0 commit comments

Comments
 (0)