Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions include/fujiDeviceID.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef FUJI_DEVICES_H
#define FUJI_DEVICES_H

enum fujiDeviceID_t {
FUJI_DEVICEID_FUJINET = 0x70,

FUJI_DEVICEID_DISK = 0x31,
FUJI_DEVICEID_DISK_LAST = 0x3F,
FUJI_DEVICEID_PRINTER = 0x40,
FUJI_DEVICEID_PRINTER_LAST = 0x43,
FUJI_DEVICEID_VOICE = 0x43,
FUJI_DEVICEID_CLOCK = 0x45,
FUJI_DEVICEID_SIO2BT_SMART = 0x45, // Doubles as APETime and "High Score Submission" to URL
FUJI_DEVICEID_ASPEQT = 0x46,
FUJI_DEVICEID_SIO2BT_NET = 0x4E,
FUJI_DEVICEID_TYPE3POLL = 0x4F,
FUJI_DEVICEID_SERIAL = 0x50,
FUJI_DEVICEID_SERIAL_LAST = 0x53,
FUJI_DEVICEID_CPM = 0x5A,
FUJI_DEVICEID_CASSETTE = 0x5F,
FUJI_DEVICEID_PCLINK = 0x6F,
FUJI_DEVICEID_NETWORK = 0x71,
FUJI_DEVICEID_NETWORK_LAST = 0x78,
FUJI_DEVICEID_MIDI = 0x99,
};

#endif /* FUJI_DEVICES_H */
24 changes: 12 additions & 12 deletions lib/bus/comlynx/comlynx.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class virtualDevice
* @brief Do any tasks that can only be done when the bus is quiet
*/
virtual void comlynx_idle();

/**
* @brief send current status of device
*/
Expand All @@ -189,7 +189,7 @@ class virtualDevice
* @brief send status response
*/
virtual void comlynx_response_status();

/**
* @brief command frame, used by network protocol, ultimately
*/
Expand Down Expand Up @@ -234,7 +234,7 @@ class virtualDevice
*/
uint8_t id() { return _devnum; }


};

/**
Expand All @@ -247,7 +247,7 @@ class systemBus
virtualDevice *_activeDev = nullptr;
lynxFuji *_fujiDev = nullptr;
lynxPrinter *_printerDev = nullptr;


void _comlynx_process_cmd();
void _comlynx_process_queue();
Expand All @@ -272,15 +272,15 @@ class systemBus
//int64_t comlynx_idle_time = 1000;

int numDevices();
void addDevice(virtualDevice *pDevice, uint8_t device_id);
void addDevice(virtualDevice *pDevice, FujiDeviceID device_id);
void remDevice(virtualDevice *pDevice);
void remDevice(uint8_t device_id);
bool deviceExists(uint8_t device_id);
void enableDevice(uint8_t device_id);
void disableDevice(uint8_t device_id);
virtualDevice *deviceById(uint8_t device_id);
void changeDeviceId(virtualDevice *pDevice, uint8_t device_id);
bool deviceEnabled(uint8_t device_id);
void remDevice(FujiDeviceID device_id);
bool deviceExists(FujiDeviceID device_id);
void enableDevice(FujiDeviceID device_id);
void disableDevice(FujiDeviceID device_id);
virtualDevice *deviceById(FujiDeviceID device_id);
void changeDeviceId(virtualDevice *pDevice, FujiDeviceID device_id);
bool deviceEnabled(FujiDeviceID device_id);
QueueHandle_t qComlynxMessages = nullptr;
void setUDPHost(const char *newhost, int port); // Set new host/ip & port for UDP Stream

Expand Down
61 changes: 15 additions & 46 deletions lib/bus/cx16_i2c/cx16_i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,37 @@
#include <string>
#include <driver/i2c.h>

#define CX16_DEVICEID_DISK 0x31
#define CX16_DEVICEID_DISK_LAST 0x3F

#define CX16_DEVICEID_PRINTER 0x40
#define CX16_DEVICEID_PRINTER_LAST 0x43

#define CX16_DEVICEID_FN_VOICE 0x43

#define CX16_DEVICEID_APETIME 0x45

#define CX16_DEVICEID_TYPE3POLL 0x4F

#define CX16_DEVICEID_RS232 0x50
#define CX16_DEVICEID_RS2323_LAST 0x53

#define CX16_DEVICEID_CASSETTE 0x5F

#define CX16_DEVICEID_FUJINET 0x70
#define CX16_DEVICEID_FN_NETWORK 0x71
#define CX16_DEVICEID_FN_NETWORK_LAST 0x78

#define CX16_DEVICEID_MIDI 0x99

#define CX16_DEVICEID_SIO2BT_NET 0x4E
#define CX16_DEVICEID_SIO2BT_SMART 0x45 // Doubles as APETime and "High Score Submission" to URL
#define CX16_DEVICEID_APE 0x45
#define CX16_DEVICEID_ASPEQT 0x46
#define CX16_DEVICEID_PCLINK 0x6F

#define CX16_DEVICEID_CPM 0x5A

#define I2C_SLAVE_TX_BUF_LEN 255
#define I2C_SLAVE_TX_BUF_LEN 255
#define I2C_SLAVE_RX_BUF_LEN 32
#define I2C_DEVICE_ID 0x70

/**
* | Address | R/W | Description
* |--- |--- |---
* | 0 | W | Device ID
* | 1 | W | Command
* | 2 | W | Aux1
* | 3 | W | Aux2
* | 1 | W | Command
* | 2 | W | Aux1
* | 3 | W | Aux2
* | 4 | W | Checksum of addresses 0-3
* | 5 | R | (A)CK/(N)ACK
* | 6 | R | (C)OMPLETE/(E)RROR
* | 7 | R/W | Payload Length (LO)
* | 8 | R/W | Payload Length (HI)
* | 9 | R/W | Payload Data (auto-increment)
*
* | 9 | R/W | Payload Data (auto-increment)
*
* Any write to address 0 will zero out all other addresses.
* Read to address 0 to perform command
*
*
* So the sequence to perform a command to the fujinet:
*
*
* 1. Write addresses 0-4 for command frame.
* 2. if a write payload is needed, write length lo/hi, then write payload data for # of bytes in length
* 3. READ from address 0 to perform command.
* 4. Check ACK/NAK
* 5. Check COMPLETE/ERROR
*
*
* Alternatively, to perform a command from fujinet to the CX16:
*
*
* 1. Write addresses 0-4 for the command frame.
* 2. If a read payload is expected, write length lo/hi.
* 3. READ from address 0 to perform command.
Expand Down Expand Up @@ -129,7 +98,7 @@ class virtualDevice
/**
* @brief The passed in command frame, copied.
*/
cmdFrame_t cmdFrame;
cmdFrame_t cmdFrame;

/**
* @brief Message queue
Expand Down Expand Up @@ -337,7 +306,7 @@ class systemBus
* @param pDevice Pointer to virtualDevice
* @param device_id The ID to assign to virtualDevice
*/
void addDevice(virtualDevice *pDevice, int device_id);
void addDevice(virtualDevice *pDevice, FujiDeviceID device_id);

/**
* @brief Remove device from bus
Expand All @@ -350,14 +319,14 @@ class systemBus
* @param device_id ID of device to return.
* @return pointer to virtualDevice
*/
virtualDevice *deviceById(int device_id);
virtualDevice *deviceById(FujiDeviceID device_id);

/**
* @brief Change ID of a particular virtualDevice
* @param pDevice pointer to virtualDevice
* @param device_id new device ID
* @param device_id new device ID
*/
void changeDeviceId(virtualDevice *pDevice, int device_id);
void changeDeviceId(virtualDevice *pDevice, FujiDeviceID device_id);

/**
* @brief Are we shutting down?
Expand Down
22 changes: 11 additions & 11 deletions lib/bus/h89/h89.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ class virtualDevice
virtual void reset() {};

/**
* @brief All H89 devices repeatedly call this routine to fan out to other methods for each command.
* @brief All H89 devices repeatedly call this routine to fan out to other methods for each command.
* This is typcially implemented as a switch() statement.
*/
virtual void process(uint32_t commanddata, uint8_t checksum) = 0;

/**
* @brief send current status of device
*/
Expand Down Expand Up @@ -97,20 +97,20 @@ class systemBus

public:
void setup(); // one time setup
void service(); // this runs in a loop
void service(); // this runs in a loop
void shutdown(); // shutdown
void reset(); // reset

int numDevices();
void addDevice(virtualDevice *pDevice, uint8_t device_id);
void addDevice(virtualDevice *pDevice, FujiDeviceID device_id);
void remDevice(virtualDevice *pDevice);
void remDevice(uint8_t device_id);
bool deviceExists(uint8_t device_id);
void enableDevice(uint8_t device_id);
void disableDevice(uint8_t device_id);
bool enabledDeviceStatus(uint8_t device_id);
virtualDevice *deviceById(uint8_t device_id);
void changeDeviceId(virtualDevice *pDevice, uint8_t device_id);
void remDevice(FujiDeviceID device_id);
bool deviceExists(FujiDeviceID device_id);
void enableDevice(FujiDeviceID device_id);
void disableDevice(FujiDeviceID device_id);
bool enabledDeviceStatus(FujiDeviceID device_id);
virtualDevice *deviceById(FujiDeviceID device_id);
void changeDeviceId(virtualDevice *pDevice, FujiDeviceID device_id);
QueueHandle_t qH89Messages = nullptr;

bool shuttingDown = false; // TRUE if we are in shutdown process
Expand Down
44 changes: 14 additions & 30 deletions lib/bus/rc2014bus/rc2014bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,6 @@

#define RC2014SIO_BAUDRATE 115200

#define RC2014_DEVICEID_DISK 0x31
#define RC2014_DEVICEID_DISK_LAST 0x3F

#define RC2014_DEVICEID_PRINTER 0x41
#define RC2014_DEVICEID_PRINTER_LAST 0x44


#define RC2014_DEVICEID_FUJINET 0x70
#define RC2014_DEVICEID_FN_NETWORK 0x71
#define RC2014_DEVICEID_FN_NETWORK_LAST 0x78

#define RC2014_DEVICEID_MODEM 0x50

#define RC2014_DEVICEID_CPM 0x5A


#define rc2014_RESET_DEBOUNCE_PERIOD 100 // in ms

constexpr int RC2014_TX_BUFFER_SIZE = 1024;
Expand Down Expand Up @@ -217,7 +201,7 @@ class virtualDevice
*/
uint8_t rc2014_recv();

/**
/**
* How many bytes available?
*/
int rc2014_recv_available();
Expand Down Expand Up @@ -296,7 +280,7 @@ class virtualDevice
virtual void shutdown() {}

/**
* @brief All RS232 devices repeatedly call this routine to fan out to other methods for each command.
* @brief All RS232 devices repeatedly call this routine to fan out to other methods for each command.
* This is typcially implemented as a switch() statement.
*/
virtual void rc2014_process(uint32_t commanddata, uint8_t checksum) = 0;
Expand All @@ -305,7 +289,7 @@ class virtualDevice
* @brief Do any tasks that can only be done when the bus is quiet
*/
virtual void rc2014_idle();

/**
* @brief send current status of device
*/
Expand All @@ -315,7 +299,7 @@ class virtualDevice
* @brief send status response
*/
virtual void rc2014_response_status();

/**
* @brief handle the uart stream when not used for command
*/
Expand All @@ -325,7 +309,7 @@ class virtualDevice
* @brief poll device to see if an interrupt needs to be raised
*/
virtual bool rc2014_poll_interrupt();


/**
* @brief command frame, used by network protocol, ultimately
Expand Down Expand Up @@ -395,17 +379,17 @@ class systemBus
int64_t start_time;

int numDevices();
void addDevice(virtualDevice *pDevice, uint8_t device_id);
void addDevice(virtualDevice *pDevice, FujiDeviceID device_id);
void remDevice(virtualDevice *pDevice);
void remDevice(uint8_t device_id);
bool deviceExists(uint8_t device_id);
void enableDevice(uint8_t device_id);
void disableDevice(uint8_t device_id);
bool enabledDeviceStatus(uint8_t device_id);
void streamDevice(uint8_t device_id);
void remDevice(FujiDeviceID device_id);
bool deviceExists(FujiDeviceID device_id);
void enableDevice(FujiDeviceID device_id);
void disableDevice(FujiDeviceID device_id);
bool enabledDeviceStatus(FujiDeviceID device_id);
void streamDevice(FujiDeviceID device_id);
void streamDeactivate();
virtualDevice *deviceById(uint8_t device_id);
void changeDeviceId(virtualDevice *pDevice, uint8_t device_id);
virtualDevice *deviceById(FujiDeviceID device_id);
void changeDeviceId(virtualDevice *pDevice, FujiDeviceID device_id);
QueueHandle_t qrc2014Messages = nullptr;

bool shuttingDown = false; // TRUE if we are in shutdown process
Expand Down
Loading
Loading