Skip to content

Commit 2756e00

Browse files
committed
Atari LWM compiles
1 parent f1466d1 commit 2756e00

File tree

19 files changed

+282
-181
lines changed

19 files changed

+282
-181
lines changed

fujinet_pc.cmake

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,11 @@ set(SOURCES src/main.cpp
163163
lib/utils/U8Char.h lib/utils/U8Char.cpp
164164
lib/hardware/fnWiFi.h lib/hardware/fnDummyWiFi.h lib/hardware/fnDummyWiFi.cpp
165165
lib/hardware/led.h lib/hardware/led.cpp
166-
lib/hardware/fnUART.h lib/hardware/fnUART.cpp
167-
lib/hardware/fnUARTUnix.cpp lib/hardware/fnUARTWindows.cpp
166+
lib/hardware/ACMChannel.cpp lib/hardware/ACMChannel.h
167+
lib/hardware/COMChannel.h
168+
lib/hardware/IOChannel.cpp lib/hardware/IOChannel.h
169+
lib/hardware/TTYChannel.cpp lib/hardware/TTYChannel.h
170+
lib/hardware/UARTChannel.h
168171
lib/hardware/fnSystem.h lib/hardware/fnSystem.cpp lib/hardware/fnSystemNet.cpp
169172
lib/FileSystem/fnDirCache.h lib/FileSystem/fnDirCache.cpp
170173
lib/FileSystem/fnFileCache.h lib/FileSystem/fnFileCache.cpp
@@ -263,10 +266,7 @@ if(FUJINET_TARGET STREQUAL "ATARI")
263266
list(APPEND SOURCES
264267

265268
lib/bus/sio/sio.h lib/bus/sio/sio.cpp
266-
lib/bus/sio/siocom/sioport.h lib/bus/sio/siocom/sioport.cpp
267-
lib/bus/sio/siocom/serialsio.h lib/bus/sio/siocom/serialsio.cpp
268-
lib/bus/sio/siocom/netsio.h lib/bus/sio/siocom/netsio.cpp
269-
lib/bus/sio/siocom/fnSioCom.h lib/bus/sio/siocom/fnSioCom.cpp
269+
lib/bus/sio/NetSIO.h lib/bus/sio/NetSIO.cpp
270270
lib/media/atari/diskType.h lib/media/atari/diskType.cpp
271271
lib/media/atari/diskTypeAtr.h lib/media/atari/diskTypeAtr.cpp
272272
lib/media/atari/diskTypeAtx.h lib/media/atari/diskTypeAtx.cpp
@@ -361,16 +361,13 @@ if(FUJINET_TARGET STREQUAL "COCO")
361361
list(APPEND SOURCES
362362

363363
lib/bus/drivewire/drivewire.h lib/bus/drivewire/drivewire.cpp
364-
lib/bus/drivewire/dwcom/fnDwCom.h lib/bus/drivewire/dwcom/fnDwCom.cpp
365-
lib/bus/drivewire/dwcom/dwport.h lib/bus/drivewire/dwcom/dwport.cpp
366-
lib/bus/drivewire/dwcom/dwserial.h lib/bus/drivewire/dwcom/dwserial.cpp
367-
lib/bus/drivewire/dwcom/dwbecker.h lib/bus/drivewire/dwcom/dwbecker.cpp
364+
lib/bus/drivewire/BeckerSocket.h lib/bus/drivewire/BeckerSocket.cpp
368365

369366
lib/media/drivewire/mediaType.h lib/media/drivewire/mediaType.cpp
370367
lib/media/drivewire/mediaTypeDSK.h lib/media/drivewire/mediaTypeDSK.cpp
371368
lib/media/drivewire/mediaTypeMRM.h lib/media/drivewire/mediaTypeMRM.cpp
372369
lib/media/drivewire/mediaTypeVDK.h lib/media/drivewire/mediaTypeVDK.cpp
373-
370+
374371
lib/device/drivewire/fuji.h lib/device/drivewire/fuji.cpp
375372
lib/device/drivewire/network.h lib/device/drivewire/network.cpp
376373
lib/device/drivewire/dload.h lib/device/drivewire/dload.cpp

lib/bus/drivewire/BeckerSocket.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,10 @@ size_t BeckerSocket::dataOut(const void *buffer, size_t size)
671671
return result;
672672
}
673673

674-
//
675-
// Becker state handlers
676-
//
674+
void BeckerSocket::setHost(std::string host, int port)
675+
{
676+
_host = host;
677+
_port = port;
678+
}
677679

678680
#endif // BUILD_COCO

lib/bus/drivewire/BeckerSocket.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ class BeckerSocket : public IOChannel
8383
void setCTS(bool state) { return; }
8484

8585
void flushOutput() override;
86+
87+
void setHost(std::string host, int port);
8688
};
8789

8890
#endif // BECKERSOCKET_H

lib/bus/drivewire/drivewire.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ void systemBus::op_readex()
158158
{
159159
size_t bytesrd;
160160
Debug_printf("op_readex: open successful %s\r\n", szNamedMount);
161-
161+
162162
memset(blk_buffer,0,MEDIA_BLOCK_SIZE);
163163
bytesrd = fread(blk_buffer,1,MEDIA_BLOCK_SIZE,pNamedObjFp);
164164
if (bytesrd!=MEDIA_BLOCK_SIZE || feof(pNamedObjFp))
165-
{
165+
{
166166
Debug_printf("op_readex: closed named object %s\r\n",szNamedMount);
167167
fclose(pNamedObjFp);
168168
pNamedObjFp = NULL;
@@ -178,7 +178,7 @@ void systemBus::op_readex()
178178
}
179179
}
180180
else
181-
{
181+
{
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

@@ -211,7 +211,7 @@ void systemBus::op_readex()
211211
blk_size = MEDIA_BLOCK_SIZE;
212212
use_media_buffer = false;
213213
}
214-
214+
215215
if (bDragon)
216216
{
217217
Debug_printf("dragon read\n");
@@ -680,6 +680,7 @@ void systemBus::service()
680680
// dload.dload_process();
681681
}
682682

683+
#ifdef ESP_PLATFORM
683684
void systemBus::configureGPIO()
684685
{
685686
// Setup interrupt for cassette motor pin
@@ -713,7 +714,7 @@ void systemBus::configureGPIO()
713714
return;
714715
}
715716

716-
int readBaudSwitch()
717+
int systemBus::readBaudSwitch()
717718
{
718719
if (fnSystem.digital_read(PIN_EPROM_A14) == DIGI_LOW
719720
&& fnSystem.digital_read(PIN_EPROM_A15) == DIGI_LOW)
@@ -739,6 +740,7 @@ int readBaudSwitch()
739740
Debug_printv("A14 and A15 High, defaulting to 57600 baud");
740741
return 57600; //Default or no switch
741742
}
743+
#endif /* ESP_PLATFORM */
742744

743745
// Setup DRIVEWIRE bus
744746
void systemBus::setup()

lib/bus/drivewire/drivewire.h

Lines changed: 57 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -34,33 +34,33 @@
3434
#define DRIVEWIRE_BAUDRATE 57600
3535

3636
/* Operation Codes */
37-
#define OP_NOP 0
37+
#define OP_NOP 0
3838
#define OP_JEFF 0xA5
3939
#define OP_SERREAD 'C'
4040
#define OP_SERREADM 'c'
4141
#define OP_SERWRITE 0xC3
4242
#define OP_SERWRITEM 0x64
43-
#define OP_GETSTAT 'G'
44-
#define OP_SETSTAT 'S'
45-
#define OP_SERGETSTAT 'D'
46-
#define OP_SERSETSTAT 'D'+128
47-
#define OP_READ 'R'
48-
#define OP_READEX 'R'+128
49-
#define OP_WRITE 'W'
50-
#define OP_REREAD 'r'
51-
#define OP_REREADEX 'r'+128
52-
#define OP_REWRITE 'w'
53-
#define OP_INIT 'I'
54-
#define OP_SERINIT 'E'
55-
#define OP_SERTERM 'E'+128
43+
#define OP_GETSTAT 'G'
44+
#define OP_SETSTAT 'S'
45+
#define OP_SERGETSTAT 'D'
46+
#define OP_SERSETSTAT 'D'+128
47+
#define OP_READ 'R'
48+
#define OP_READEX 'R'+128
49+
#define OP_WRITE 'W'
50+
#define OP_REREAD 'r'
51+
#define OP_REREADEX 'r'+128
52+
#define OP_REWRITE 'w'
53+
#define OP_INIT 'I'
54+
#define OP_SERINIT 'E'
55+
#define OP_SERTERM 'E'+128
5656
#define OP_DWINIT 'Z'
57-
#define OP_TERM 'T'
58-
#define OP_TIME '#'
57+
#define OP_TERM 'T'
58+
#define OP_TIME '#'
5959
#define OP_RESET3 0xF8
60-
#define OP_RESET2 0xFE
61-
#define OP_RESET1 0xFF
62-
#define OP_PRINT 'P'
63-
#define OP_PRINTFLUSH 'F'
60+
#define OP_RESET2 0xFE
61+
#define OP_RESET1 0xFF
62+
#define OP_PRINT 'P'
63+
#define OP_PRINTFLUSH 'F'
6464
#define OP_VPORT_READ 'C'
6565
#define OP_FUJI 0xE2
6666
#define OP_NET 0xE3
@@ -82,26 +82,26 @@
8282

8383
// struct dwTransferData
8484
// {
85-
// int dw_protocol_vrsn;
86-
// FILE *devpath;
87-
// FILE *dskpath[4];
88-
// int cocoType;
89-
// int baudRate;
90-
// unsigned char lastDrive;
91-
// uint32_t readRetries;
92-
// uint32_t writeRetries;
93-
// uint32_t sectorsRead;
94-
// uint32_t sectorsWritten;
95-
// unsigned char lastOpcode;
96-
// unsigned char lastLSN[3];
97-
// unsigned char lastSector[256];
98-
// unsigned char lastGetStat;
99-
// unsigned char lastSetStat;
100-
// uint16_t lastChecksum;
101-
// unsigned char lastError;
102-
// FILE *prtfp;
103-
// unsigned char lastChar;
104-
// char prtcmd[80];
85+
// int dw_protocol_vrsn;
86+
// FILE *devpath;
87+
// FILE *dskpath[4];
88+
// int cocoType;
89+
// int baudRate;
90+
// unsigned char lastDrive;
91+
// uint32_t readRetries;
92+
// uint32_t writeRetries;
93+
// uint32_t sectorsRead;
94+
// uint32_t sectorsWritten;
95+
// unsigned char lastOpcode;
96+
// unsigned char lastLSN[3];
97+
// unsigned char lastSector[256];
98+
// unsigned char lastGetStat;
99+
// unsigned char lastSetStat;
100+
// uint16_t lastChecksum;
101+
// unsigned char lastError;
102+
// FILE *prtfp;
103+
// unsigned char lastChar;
104+
// char prtcmd[80];
105105
// };
106106

107107
// EXTERN char device[256];
@@ -151,7 +151,7 @@ class virtualDevice
151151

152152
cmdFrame_t cmdFrame;
153153
bool listen_to_type3_polls = false;
154-
154+
155155
// Optional shutdown/reboot cleanup routine
156156
virtual void shutdown(){};
157157

@@ -187,7 +187,7 @@ class systemBus
187187
IOChannel *_port = nullptr;
188188
UARTChannel _serial;
189189
BeckerSocket _becker;
190-
190+
191191
virtualDevice *_activeDev = nullptr;
192192
drivewireModem *_modemDev = nullptr;
193193
drivewireFuji *_fujiDev = nullptr;
@@ -203,6 +203,11 @@ class systemBus
203203
void _drivewire_process_cmd();
204204
void _drivewire_process_queue();
205205

206+
#ifdef ESP_PLATFORM
207+
void configureGPIO();
208+
int readBaudSwitch();
209+
#endif /* ESP_PLATFORM */
210+
206211
/**
207212
* @brief Current Baud Rate
208213
*/
@@ -329,10 +334,19 @@ class systemBus
329334
size_t write(int n) { return _port->write(n); }
330335
size_t available() { return _port->available(); }
331336
void flushOutput() { _port->flushOutput(); }
332-
337+
333338
#ifdef ESP32_PLATFORM
334339
QueueHandle_t qDrivewireMessages = nullptr;
335340
#endif
341+
342+
/* BoIP things */
343+
void setHost(const char *host, int port) { _becker.setHost(host, port); }
344+
void selectSerialPort(bool useSerial) {
345+
if (useSerial)
346+
_port = &_serial;
347+
else
348+
_port = &_becker;
349+
}
336350
};
337351

338352
extern systemBus SYSTEM_BUS;

lib/bus/rs232/rs232.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class systemBus
267267
size_t write(const void *buffer, size_t length) { return _port.write(buffer, length); }
268268
size_t write(int n) { return _port.write(n); }
269269
size_t available() { return _port.available(); }
270-
void flush() { _port.flush(); }
270+
void flushOutput() { _port.flushOutput(); }
271271
size_t print(int n, int base = 10) { return _port.print(n, base); }
272272
size_t print(const char *str) { return _port.print(str); }
273273
size_t print(const std::string &str) { return _port.print(str); }

0 commit comments

Comments
 (0)