Skip to content

Commit 8a34c47

Browse files
committed
Merge branch 'master' into lynx-compile
2 parents bea6937 + 4edcf0b commit 8a34c47

File tree

19 files changed

+166
-249
lines changed

19 files changed

+166
-249
lines changed
0 Bytes
Binary file not shown.

include/fujiDeviceID.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef FUJI_DEVICES_H
2+
#define FUJI_DEVICES_H
3+
4+
enum fujiDeviceID_t {
5+
FUJI_DEVICEID_FUJINET = 0x70,
6+
7+
FUJI_DEVICEID_DISK = 0x31,
8+
FUJI_DEVICEID_DISK_LAST = 0x3F,
9+
FUJI_DEVICEID_PRINTER = 0x40,
10+
FUJI_DEVICEID_PRINTER_LAST = 0x43,
11+
FUJI_DEVICEID_VOICE = 0x43,
12+
FUJI_DEVICEID_CLOCK = 0x45,
13+
FUJI_DEVICEID_SIO2BT_SMART = 0x45, // Doubles as APETime and "High Score Submission" to URL
14+
FUJI_DEVICEID_ASPEQT = 0x46,
15+
FUJI_DEVICEID_SIO2BT_NET = 0x4E,
16+
FUJI_DEVICEID_TYPE3POLL = 0x4F,
17+
FUJI_DEVICEID_SERIAL = 0x50,
18+
FUJI_DEVICEID_SERIAL_LAST = 0x53,
19+
FUJI_DEVICEID_CPM = 0x5A,
20+
FUJI_DEVICEID_CASSETTE = 0x5F,
21+
FUJI_DEVICEID_PCLINK = 0x6F,
22+
FUJI_DEVICEID_NETWORK = 0x71,
23+
FUJI_DEVICEID_NETWORK_LAST = 0x78,
24+
FUJI_DEVICEID_MIDI = 0x99,
25+
};
26+
27+
#endif /* FUJI_DEVICES_H */

lib/bus/comlynx/comlynx.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class virtualDevice
175175
* @brief Do any tasks that can only be done when the bus is quiet
176176
*/
177177
virtual void comlynx_idle();
178-
178+
179179
/**
180180
* @brief send current status of device
181181
*/
@@ -190,7 +190,7 @@ class virtualDevice
190190
* @brief send status response
191191
*/
192192
virtual void comlynx_response_status();
193-
193+
194194
/**
195195
* @brief command frame, used by network protocol, ultimately
196196
*/
@@ -235,7 +235,7 @@ class virtualDevice
235235
*/
236236
uint8_t id() { return _devnum; }
237237

238-
238+
239239
};
240240

241241
/**
@@ -248,7 +248,7 @@ class systemBus
248248
virtualDevice *_activeDev = nullptr;
249249
lynxFuji *_fujiDev = nullptr;
250250
lynxPrinter *_printerDev = nullptr;
251-
251+
252252
UARTChannel _port;
253253

254254
void _comlynx_process_cmd();
@@ -274,15 +274,15 @@ class systemBus
274274
//int64_t comlynx_idle_time = 1000;
275275

276276
int numDevices();
277-
void addDevice(virtualDevice *pDevice, uint8_t device_id);
277+
void addDevice(virtualDevice *pDevice, fujiDeviceID_t device_id);
278278
void remDevice(virtualDevice *pDevice);
279-
void remDevice(uint8_t device_id);
280-
bool deviceExists(uint8_t device_id);
281-
void enableDevice(uint8_t device_id);
282-
void disableDevice(uint8_t device_id);
283-
virtualDevice *deviceById(uint8_t device_id);
284-
void changeDeviceId(virtualDevice *pDevice, uint8_t device_id);
285-
bool deviceEnabled(uint8_t device_id);
279+
void remDevice(fujiDeviceID_t device_id);
280+
bool deviceExists(fujiDeviceID_t device_id);
281+
void enableDevice(fujiDeviceID_t device_id);
282+
void disableDevice(fujiDeviceID_t device_id);
283+
virtualDevice *deviceById(fujiDeviceID_t device_id);
284+
void changeDeviceId(virtualDevice *pDevice, fujiDeviceID_t device_id);
285+
bool deviceEnabled(fujiDeviceID_t device_id);
286286
QueueHandle_t qComlynxMessages = nullptr;
287287
void setUDPHost(const char *newhost, int port); // Set new host/ip & port for UDP Stream
288288

lib/bus/cx16_i2c/cx16_i2c.h

Lines changed: 15 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,68 +9,37 @@
99
#include <string>
1010
#include <driver/i2c.h>
1111

12-
#define CX16_DEVICEID_DISK 0x31
13-
#define CX16_DEVICEID_DISK_LAST 0x3F
14-
15-
#define CX16_DEVICEID_PRINTER 0x40
16-
#define CX16_DEVICEID_PRINTER_LAST 0x43
17-
18-
#define CX16_DEVICEID_FN_VOICE 0x43
19-
20-
#define CX16_DEVICEID_APETIME 0x45
21-
22-
#define CX16_DEVICEID_TYPE3POLL 0x4F
23-
24-
#define CX16_DEVICEID_RS232 0x50
25-
#define CX16_DEVICEID_RS2323_LAST 0x53
26-
27-
#define CX16_DEVICEID_CASSETTE 0x5F
28-
29-
#define CX16_DEVICEID_FUJINET 0x70
30-
#define CX16_DEVICEID_FN_NETWORK 0x71
31-
#define CX16_DEVICEID_FN_NETWORK_LAST 0x78
32-
33-
#define CX16_DEVICEID_MIDI 0x99
34-
35-
#define CX16_DEVICEID_SIO2BT_NET 0x4E
36-
#define CX16_DEVICEID_SIO2BT_SMART 0x45 // Doubles as APETime and "High Score Submission" to URL
37-
#define CX16_DEVICEID_APE 0x45
38-
#define CX16_DEVICEID_ASPEQT 0x46
39-
#define CX16_DEVICEID_PCLINK 0x6F
40-
41-
#define CX16_DEVICEID_CPM 0x5A
42-
43-
#define I2C_SLAVE_TX_BUF_LEN 255
12+
#define I2C_SLAVE_TX_BUF_LEN 255
4413
#define I2C_SLAVE_RX_BUF_LEN 32
4514
#define I2C_DEVICE_ID 0x70
4615

4716
/**
4817
* | Address | R/W | Description
4918
* |--- |--- |---
5019
* | 0 | W | Device ID
51-
* | 1 | W | Command
52-
* | 2 | W | Aux1
53-
* | 3 | W | Aux2
20+
* | 1 | W | Command
21+
* | 2 | W | Aux1
22+
* | 3 | W | Aux2
5423
* | 4 | W | Checksum of addresses 0-3
5524
* | 5 | R | (A)CK/(N)ACK
5625
* | 6 | R | (C)OMPLETE/(E)RROR
5726
* | 7 | R/W | Payload Length (LO)
5827
* | 8 | R/W | Payload Length (HI)
59-
* | 9 | R/W | Payload Data (auto-increment)
60-
*
28+
* | 9 | R/W | Payload Data (auto-increment)
29+
*
6130
* Any write to address 0 will zero out all other addresses.
6231
* Read to address 0 to perform command
63-
*
32+
*
6433
* So the sequence to perform a command to the fujinet:
65-
*
34+
*
6635
* 1. Write addresses 0-4 for command frame.
6736
* 2. if a write payload is needed, write length lo/hi, then write payload data for # of bytes in length
6837
* 3. READ from address 0 to perform command.
6938
* 4. Check ACK/NAK
7039
* 5. Check COMPLETE/ERROR
71-
*
40+
*
7241
* Alternatively, to perform a command from fujinet to the CX16:
73-
*
42+
*
7443
* 1. Write addresses 0-4 for the command frame.
7544
* 2. If a read payload is expected, write length lo/hi.
7645
* 3. READ from address 0 to perform command.
@@ -129,7 +98,7 @@ class virtualDevice
12998
/**
13099
* @brief The passed in command frame, copied.
131100
*/
132-
cmdFrame_t cmdFrame;
101+
cmdFrame_t cmdFrame;
133102

134103
/**
135104
* @brief Message queue
@@ -337,7 +306,7 @@ class systemBus
337306
* @param pDevice Pointer to virtualDevice
338307
* @param device_id The ID to assign to virtualDevice
339308
*/
340-
void addDevice(virtualDevice *pDevice, int device_id);
309+
void addDevice(virtualDevice *pDevice, FujiDeviceID device_id);
341310

342311
/**
343312
* @brief Remove device from bus
@@ -350,14 +319,14 @@ class systemBus
350319
* @param device_id ID of device to return.
351320
* @return pointer to virtualDevice
352321
*/
353-
virtualDevice *deviceById(int device_id);
322+
virtualDevice *deviceById(FujiDeviceID device_id);
354323

355324
/**
356325
* @brief Change ID of a particular virtualDevice
357326
* @param pDevice pointer to virtualDevice
358-
* @param device_id new device ID
327+
* @param device_id new device ID
359328
*/
360-
void changeDeviceId(virtualDevice *pDevice, int device_id);
329+
void changeDeviceId(virtualDevice *pDevice, FujiDeviceID device_id);
361330

362331
/**
363332
* @brief Are we shutting down?

lib/bus/h89/h89.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ class virtualDevice
5656
virtual void reset() {};
5757

5858
/**
59-
* @brief All H89 devices repeatedly call this routine to fan out to other methods for each command.
59+
* @brief All H89 devices repeatedly call this routine to fan out to other methods for each command.
6060
* This is typcially implemented as a switch() statement.
6161
*/
6262
virtual void process(uint32_t commanddata, uint8_t checksum) = 0;
63-
63+
6464
/**
6565
* @brief send current status of device
6666
*/
@@ -97,20 +97,20 @@ class systemBus
9797

9898
public:
9999
void setup(); // one time setup
100-
void service(); // this runs in a loop
100+
void service(); // this runs in a loop
101101
void shutdown(); // shutdown
102102
void reset(); // reset
103103

104104
int numDevices();
105-
void addDevice(virtualDevice *pDevice, uint8_t device_id);
105+
void addDevice(virtualDevice *pDevice, FujiDeviceID device_id);
106106
void remDevice(virtualDevice *pDevice);
107-
void remDevice(uint8_t device_id);
108-
bool deviceExists(uint8_t device_id);
109-
void enableDevice(uint8_t device_id);
110-
void disableDevice(uint8_t device_id);
111-
bool enabledDeviceStatus(uint8_t device_id);
112-
virtualDevice *deviceById(uint8_t device_id);
113-
void changeDeviceId(virtualDevice *pDevice, uint8_t device_id);
107+
void remDevice(FujiDeviceID device_id);
108+
bool deviceExists(FujiDeviceID device_id);
109+
void enableDevice(FujiDeviceID device_id);
110+
void disableDevice(FujiDeviceID device_id);
111+
bool enabledDeviceStatus(FujiDeviceID device_id);
112+
virtualDevice *deviceById(FujiDeviceID device_id);
113+
void changeDeviceId(virtualDevice *pDevice, FujiDeviceID device_id);
114114
QueueHandle_t qH89Messages = nullptr;
115115

116116
bool shuttingDown = false; // TRUE if we are in shutdown process

lib/bus/rc2014bus/rc2014bus.h

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,6 @@
1717

1818
#define RC2014SIO_BAUDRATE 115200
1919

20-
#define RC2014_DEVICEID_DISK 0x31
21-
#define RC2014_DEVICEID_DISK_LAST 0x3F
22-
23-
#define RC2014_DEVICEID_PRINTER 0x41
24-
#define RC2014_DEVICEID_PRINTER_LAST 0x44
25-
26-
27-
#define RC2014_DEVICEID_FUJINET 0x70
28-
#define RC2014_DEVICEID_FN_NETWORK 0x71
29-
#define RC2014_DEVICEID_FN_NETWORK_LAST 0x78
30-
31-
#define RC2014_DEVICEID_MODEM 0x50
32-
33-
#define RC2014_DEVICEID_CPM 0x5A
34-
35-
3620
#define rc2014_RESET_DEBOUNCE_PERIOD 100 // in ms
3721

3822
constexpr int RC2014_TX_BUFFER_SIZE = 1024;
@@ -217,7 +201,7 @@ class virtualDevice
217201
*/
218202
uint8_t rc2014_recv();
219203

220-
/**
204+
/**
221205
* How many bytes available?
222206
*/
223207
int rc2014_recv_available();
@@ -296,7 +280,7 @@ class virtualDevice
296280
virtual void shutdown() {}
297281

298282
/**
299-
* @brief All RS232 devices repeatedly call this routine to fan out to other methods for each command.
283+
* @brief All RS232 devices repeatedly call this routine to fan out to other methods for each command.
300284
* This is typcially implemented as a switch() statement.
301285
*/
302286
virtual void rc2014_process(uint32_t commanddata, uint8_t checksum) = 0;
@@ -305,7 +289,7 @@ class virtualDevice
305289
* @brief Do any tasks that can only be done when the bus is quiet
306290
*/
307291
virtual void rc2014_idle();
308-
292+
309293
/**
310294
* @brief send current status of device
311295
*/
@@ -315,7 +299,7 @@ class virtualDevice
315299
* @brief send status response
316300
*/
317301
virtual void rc2014_response_status();
318-
302+
319303
/**
320304
* @brief handle the uart stream when not used for command
321305
*/
@@ -325,7 +309,7 @@ class virtualDevice
325309
* @brief poll device to see if an interrupt needs to be raised
326310
*/
327311
virtual bool rc2014_poll_interrupt();
328-
312+
329313

330314
/**
331315
* @brief command frame, used by network protocol, ultimately
@@ -395,17 +379,17 @@ class systemBus
395379
int64_t start_time;
396380

397381
int numDevices();
398-
void addDevice(virtualDevice *pDevice, uint8_t device_id);
382+
void addDevice(virtualDevice *pDevice, FujiDeviceID device_id);
399383
void remDevice(virtualDevice *pDevice);
400-
void remDevice(uint8_t device_id);
401-
bool deviceExists(uint8_t device_id);
402-
void enableDevice(uint8_t device_id);
403-
void disableDevice(uint8_t device_id);
404-
bool enabledDeviceStatus(uint8_t device_id);
405-
void streamDevice(uint8_t device_id);
384+
void remDevice(FujiDeviceID device_id);
385+
bool deviceExists(FujiDeviceID device_id);
386+
void enableDevice(FujiDeviceID device_id);
387+
void disableDevice(FujiDeviceID device_id);
388+
bool enabledDeviceStatus(FujiDeviceID device_id);
389+
void streamDevice(FujiDeviceID device_id);
406390
void streamDeactivate();
407-
virtualDevice *deviceById(uint8_t device_id);
408-
void changeDeviceId(virtualDevice *pDevice, uint8_t device_id);
391+
virtualDevice *deviceById(FujiDeviceID device_id);
392+
void changeDeviceId(virtualDevice *pDevice, FujiDeviceID device_id);
409393
QueueHandle_t qrc2014Messages = nullptr;
410394

411395
bool shuttingDown = false; // TRUE if we are in shutdown process

0 commit comments

Comments
 (0)