Skip to content

Commit 73a079b

Browse files
committed
Prepare for fujiDevice polymorphism
1 parent e82e4fb commit 73a079b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+212
-263
lines changed

lib/bus/drivewire/drivewire.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ void systemBus::op_reset()
113113
Debug_printv("op_reset()");
114114

115115
// When a reset transaction occurs, set the mounted disk image to the CONFIG disk image.
116-
theFuji.boot_config = true;
117-
theFuji.insert_boot_device(Config.get_general_boot_mode());
116+
theFuji->boot_config = true;
117+
theFuji->insert_boot_device(Config.get_general_boot_mode());
118118
if (pNamedObjFp != NULL)
119119
{
120120
fclose(pNamedObjFp);
@@ -182,10 +182,10 @@ void systemBus::op_readex()
182182
if (true==bDragon && drive_num>=5) drive_num = drive_num-5;
183183
Debug_printf("OP_READ: DRIVE %3u - SECTOR %8lu\n", drive_num, lsn);
184184

185-
if (theFuji.boot_config && drive_num == 0)
186-
d = theFuji.bootdisk();
185+
if (theFuji->boot_config && drive_num == 0)
186+
d = theFuji->bootdisk();
187187
else
188-
d = &theFuji.get_disks(drive_num)->disk_dev;
188+
d = &theFuji->get_disk(drive_num)->disk_dev;
189189

190190
if (!d)
191191
{
@@ -306,7 +306,7 @@ void systemBus::op_write()
306306

307307
Debug_printf("OP_WRITE DRIVE %3u - SECTOR %8lu\n", drive_num, lsn);
308308

309-
d = &theFuji.get_disks(drive_num)->disk_dev;
309+
d = &theFuji->get_disk(drive_num)->disk_dev;
310310

311311
if (!d)
312312
{
@@ -334,7 +334,7 @@ void systemBus::op_write()
334334

335335
void systemBus::op_fuji()
336336
{
337-
theFuji.process();
337+
theFuji->process();
338338
}
339339

340340
void systemBus::op_cpm()

lib/bus/iec/iec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void systemBus::service()
100100
bool error = false, active = false;
101101
for(int i = 0; i < MAX_DISK_DEVICES; i++)
102102
{
103-
iecDrive *d = &(theFuji.get_disks(i)->disk_dev);
103+
iecDrive *d = &(theFuji->get_disk(i)->disk_dev);
104104
error |= d->hasError();
105105
active |= d->getNumOpenChannels()>0;
106106
}

lib/bus/iwm/iwm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,6 @@ class systemBus
353353

354354
extern systemBus SYSTEM_BUS;
355355

356-
#define IWM_ACTIVE_DISK2 ((iwmDisk2 *) theFuji.get_disk_dev(MAX_SPDISK_DEVICES + diskii_xface.iwm_active_drive() - 1))
356+
#define IWM_ACTIVE_DISK2 ((iwmDisk2 *) theFuji->get_disk_dev(MAX_SPDISK_DEVICES + diskii_xface.iwm_active_drive() - 1))
357357
#endif // guard
358358
#endif /* BUILD_APPLE */

lib/bus/mac/mac.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ void systemBus::service(void)
6464
case 0:
6565
// set direction to increase track number
6666
Debug_printf("%c", 'I');
67-
theFuji.get_disks(4)->disk_dev.set_dir(+1);
67+
theFuji->get_disk(4)->disk_dev.set_dir(+1);
6868
// fnUartBUS.write('I');
6969
// fnUartBUS.flush();
7070
break;
7171
case 4:
7272
// set direction to decrease track number
7373
Debug_printf("%c", 'D');
74-
theFuji.get_disks(4)->disk_dev.set_dir(-1);
74+
theFuji->get_disk(4)->disk_dev.set_dir(-1);
7575
// fnUartBUS.write('D');
7676
// fnUartBUS.flush();
7777
break;
@@ -81,7 +81,7 @@ void systemBus::service(void)
8181
{
8282
t0 = fnSystem.micros();
8383
track_not_copied = true;
84-
int track_position = theFuji.get_disks(4)->disk_dev.step();
84+
int track_position = theFuji->get_disk(4)->disk_dev.step();
8585
if (track_position < 0)
8686
{
8787
fnUartBUS.write('N');
@@ -110,7 +110,7 @@ void systemBus::service(void)
110110
// eject
111111
Debug_printf("\neject - unmounting");
112112
floppy_ll.stop();
113-
theFuji.get_disks(4)->disk_dev.unmount();
113+
theFuji->get_disk(4)->disk_dev.unmount();
114114
fnUartBUS.write('E');
115115
// fnUartBUS.flush();
116116
break;
@@ -136,7 +136,7 @@ void systemBus::service(void)
136136
case 'R':
137137
case 'T':
138138
case 'W':
139-
theFuji.get_disks(_active_DCD_disk)->disk_dev.process(c);
139+
theFuji->get_disk(_active_DCD_disk)->disk_dev.process(c);
140140
break;
141141
default:
142142
break;
@@ -145,7 +145,7 @@ void systemBus::service(void)
145145
}
146146
if (track_not_copied && stepper_timeout())
147147
{
148-
theFuji.get_disks(4)->disk_dev.update_track_buffers();
148+
theFuji->get_disk(4)->disk_dev.update_track_buffers();
149149
track_not_copied = false;
150150
fnUartBUS.write('S');
151151
}
@@ -733,7 +733,7 @@ void IRAM_ATTR iwmBus::service()
733733
break;
734734
case iwm_enable_state_t::off2on:
735735
// need to start a counter and wait to turn on enable output after 1 ms only iff enable state is on
736-
if (theFuji._fnDisk2s[diskii_xface.iwm_enable_states() - 1].device_active)
736+
if (theFuji->_fnDisk2s[diskii_xface.iwm_enable_states() - 1].device_active)
737737
{
738738
fnSystem.delay(1); // need a better way to figure out persistence
739739
if (iwm_drive_enabled() == iwm_enable_state_t::on)
@@ -750,7 +750,7 @@ void IRAM_ATTR iwmBus::service()
750750
return; // return so the SP code doesn't get checked
751751
case iwm_enable_state_t::on:
752752
#ifdef DEBUG
753-
new_track = theFuji._fnDisk2s[diskii_xface.iwm_enable_states() - 1].get_track_pos();
753+
new_track = theFuji->_fnDisk2s[diskii_xface.iwm_enable_states() - 1].get_track_pos();
754754
if (old_track != new_track)
755755
{
756756
Debug_printf("\ntrk pos %03d on d%d", new_track, diskii_xface.iwm_enable_states());
@@ -817,7 +817,7 @@ void iwmBus::handle_init()
817817
// tell the Fuji it's device no.
818818
if (it == _daisyChain.begin())
819819
{
820-
theFuji._devnum = command_packet.dest;
820+
theFuji->_devnum = command_packet.dest;
821821
}
822822
// assign dev numbers
823823
pDevice = (*it);

lib/console/Commands/VFSCommands.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ int mount(int argc, char **argv)
354354
int did = atoi(argv[1]);
355355
fprintf(stdout, "Mounted %d -> %s\r\n", did, argv[2]);
356356

357-
theFuji.mount_all();
357+
theFuji->mount_all();
358358

359359
return EXIT_SUCCESS;
360360
}

lib/device/adamnet/adamFuji.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222

2323
#define COPY_SIZE 532
2424

25-
adamFuji theFuji; // global fuji device object
25+
adamFuji platformFuji;
26+
adamFuji *theFuji = &platformFuji; // global fuji device object
2627
adamNetwork *theNetwork; // global network device object (temporary)
2728
adamNetwork *theNetwork2; // another network device
2829
adamPrinter *thePrinter; // global printer
@@ -1308,7 +1309,7 @@ void adamFuji::setup()
13081309
theSerial = new adamSerial();
13091310
SYSTEM_BUS.addDevice(theNetwork, 0x09); // temporary.
13101311
SYSTEM_BUS.addDevice(theNetwork2, 0x0A); // temporary
1311-
SYSTEM_BUS.addDevice(&theFuji, 0x0F); // Fuji becomes the gateway device.
1312+
SYSTEM_BUS.addDevice(theFuji, 0x0F); // Fuji becomes the gateway device.
13121313
}
13131314

13141315
// Mount all

lib/device/adamnet/adamFuji.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ class adamFuji : public virtualDevice
111111
int get_disk_id(int drive_slot);
112112
std::string get_host_prefix(int host_slot);
113113

114-
fujiHost *get_hosts(int i) { return &_fnHosts[i]; }
115-
fujiDisk *get_disks(int i) { return &_fnDisks[i]; }
114+
fujiHost *get_host(int i) { return &_fnHosts[i]; }
115+
fujiDisk *get_disk(int i) { return &_fnDisks[i]; }
116116
fujiHost *set_slot_hostname(int host_slot, char *hostname);
117117

118118
void _populate_slots_from_config();
@@ -133,7 +133,7 @@ class adamFuji : public virtualDevice
133133
TaskHandle_t copy_task_handle;
134134
};
135135

136-
extern adamFuji theFuji;
136+
extern adamFuji *theFuji;
137137
extern adamSerial *theSerial;
138138

139139
#endif // FUJI_H

lib/device/comlynx/lynxFuji.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
#define COPY_SIZE 532
2222

23-
lynxFuji theFuji; // global fuji device object
23+
lynxFuji platformFuji;
24+
lynxFuji *theFuji = &platformFuji; // global fuji device object
2425
lynxNetwork *theNetwork; // global network device object (temporary)
2526
lynxPrinter *thePrinter; // global printer
2627
lynxSerial *theSerial; // global serial
@@ -1351,7 +1352,7 @@ void lynxFuji::setup()
13511352
// Disable status_wait if our settings say to turn it off
13521353
status_wait_enabled = false;
13531354
SYSTEM_BUS.addDevice(&_fnDisks[0].disk_dev, 4);
1354-
SYSTEM_BUS.addDevice(&theFuji, 0x0F); // Fuji becomes the gateway device.
1355+
SYSTEM_BUS.addDevice(theFuji, 0x0F); // Fuji becomes the gateway device.
13551356
theNetwork = new lynxNetwork();
13561357
SYSTEM_BUS.addDevice(theNetwork, 0x09); // temporary.
13571358
}

lib/device/comlynx/lynxFuji.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ class lynxFuji : public virtualDevice
111111
int get_disk_id(int drive_slot);
112112
std::string get_host_prefix(int host_slot);
113113

114-
fujiHost *get_hosts(int i) { return &_fnHosts[i]; }
115-
fujiDisk *get_disks(int i) { return &_fnDisks[i]; }
114+
fujiHost *get_host(int i) { return &_fnHosts[i]; }
115+
fujiDisk *get_disk(int i) { return &_fnDisks[i]; }
116116
fujiHost *set_slot_hostname(int host_slot, char *hostname);
117117

118118
void _populate_slots_from_config();
@@ -133,7 +133,7 @@ class lynxFuji : public virtualDevice
133133
TaskHandle_t copy_task_handle;
134134
};
135135

136-
extern lynxFuji theFuji;
136+
extern lynxFuji *theFuji;
137137
extern lynxSerial *theSerial;
138138

139139
#endif // FUJI_H

lib/device/cx16_i2c/cx16Fuji.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
#include "utils.h"
2121
#include "string_utils.h"
2222

23-
cx16Fuji theFuji; // global fuji device object
23+
cx16Fuji platformFuji;
24+
cx16Fuji *theFuji = &platformFuji; // global fuji device object
2425

2526
using namespace std;
2627

0 commit comments

Comments
 (0)