35 #define DBG_PROGNAME "OPENCBM-XUM1541.DLL"
46 #define OPENCBM_PLUGIN
47 #include "archlib_ex.h"
77 portNumber = strtoul(Port, NULL, 10);
109 portNumber = strtoul(Port, NULL, 10);
112 return xum1541_init((usb_dev_handle **)HandleDevice, portNumber);
214 return xum1541_write((usb_dev_handle *)HandleDevice, XUM1541_CBM, Buffer, Count);
243 return xum1541_read((usb_dev_handle *)HandleDevice, XUM1541_CBM, Buffer, Count);
274 unsigned char proto, dataBuf[2];
276 proto = XUM1541_CBM | XUM_WRITE_ATN;
277 dataBuf[0] = 0x20 | DeviceAddress;
278 dataBuf[1] = 0x60 | SecondaryAddress;
279 return !
xum1541_write((usb_dev_handle *)HandleDevice, proto, dataBuf,
sizeof(dataBuf));
308 unsigned char proto, dataBuf[2];
310 proto = XUM1541_CBM | XUM_WRITE_ATN | XUM_WRITE_TALK;
311 dataBuf[0] = 0x40 | DeviceAddress;
312 dataBuf[1] = 0x60 | SecondaryAddress;
313 return !
xum1541_write((usb_dev_handle *)HandleDevice, proto, dataBuf,
sizeof(dataBuf));
340 unsigned char proto, dataBuf[2];
342 proto = XUM1541_CBM | XUM_WRITE_ATN;
343 dataBuf[0] = 0x20 | DeviceAddress;
344 dataBuf[1] = 0xf0 | SecondaryAddress;
345 return !
xum1541_write((usb_dev_handle *)HandleDevice, proto, dataBuf,
sizeof(dataBuf));
372 unsigned char proto, dataBuf[2];
374 proto = XUM1541_CBM | XUM_WRITE_ATN;
375 dataBuf[0] = 0x20 | DeviceAddress;
376 dataBuf[1] = 0xe0 | SecondaryAddress;
377 return !
xum1541_write((usb_dev_handle *)HandleDevice, proto, dataBuf,
sizeof(dataBuf));
403 unsigned char proto, dataBuf[1];
405 proto = XUM1541_CBM | XUM_WRITE_ATN;
407 return !
xum1541_write((usb_dev_handle *)HandleDevice, proto, dataBuf,
sizeof(dataBuf));
433 unsigned char proto, dataBuf[1];
435 proto = XUM1541_CBM | XUM_WRITE_ATN;
437 return !
xum1541_write((usb_dev_handle *)HandleDevice, proto, dataBuf,
sizeof(dataBuf));
464 return xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_GET_EOI, 0, 0);
485 return xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_CLEAR_EOI, 0, 0);
543 return (
unsigned char)
xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_PP_READ, 0, 0);
572 xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_PP_WRITE, Byte, 0);
599 return xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_IEC_POLL, 0, 0);
624 xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_IEC_SETRELEASE, Line, 0);
648 xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_IEC_SETRELEASE, 0, Line);
681 xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_IEC_SETRELEASE, Set, Release);
713 return xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_IEC_WAIT, Line, State);
void CBMAPIDECL opencbm_plugin_pp_write(CBM_FILE HandleDevice, unsigned char Byte)
Write a byte to a XP1541/XP1571 cable.
const char * xum1541_device_path(int PortNumber)
Query unique identifier for the xum1541 device This function tries to find an unique identifier for t...
void CBMAPIDECL opencbm_plugin_driver_close(CBM_FILE HandleDevice)
Closes the driver.
void xum1541_close(usb_dev_handle *HandleXum1541)
close the xum1541 device
int CBMAPIDECL opencbm_plugin_raw_read(CBM_FILE HandleDevice, void *Buffer, size_t Count)
Read data from the IEC serial bus.
Define makros for debugging purposes.
int CBMAPIDECL opencbm_plugin_reset(CBM_FILE HandleDevice)
RESET all devices.
void CBMAPIDECL opencbm_plugin_unlock(CBM_FILE HandleDevice)
Unlock the parallel port for the driver.
int CBMAPIDECL xum1541_plugin_control_msg(CBM_FILE HandleDevice, unsigned int cmd)
Sends a command to the xum1541 device.
const char *CBMAPIDECL opencbm_plugin_get_driver_name(const char *const Port)
Get the name of the driver for a specific parallel port.
int CBMAPIDECL opencbm_plugin_unlisten(CBM_FILE HandleDevice)
Send an UNLISTEN on the IEC serial bus.
int CBMAPIDECL opencbm_plugin_raw_write(CBM_FILE HandleDevice, const void *Buffer, size_t Count)
Write data to the IEC serial bus.
int CBMAPIDECL opencbm_plugin_clear_eoi(CBM_FILE HandleDevice)
Reset the EOI flag.
int CBMAPIDECL opencbm_plugin_iec_wait(CBM_FILE HandleDevice, int Line, int State)
Wait for a line to have a specific state.
int xum1541_write(usb_dev_handle *HandleXum1541, unsigned char modeFlags, const unsigned char *data, size_t size)
Write data to the xum1541 device.
int CBMAPIDECL opencbm_plugin_driver_open(CBM_FILE *HandleDevice, const char *const Port)
Opens the driver.
void CBMAPIDECL opencbm_plugin_iec_release(CBM_FILE HandleDevice, int Line)
Deactivate a line on the IEC serial bus.
int CBMAPIDECL opencbm_plugin_open(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress)
Open a file on the IEC serial bus.
void CBMAPIDECL opencbm_plugin_iec_setrelease(CBM_FILE HandleDevice, int Set, int Release)
Activate and deactive a line on the IEC serial bus.
void CBMAPIDECL opencbm_plugin_lock(CBM_FILE HandleDevice)
Lock the parallel port for the driver.
unsigned char CBMAPIDECL opencbm_plugin_pp_read(CBM_FILE HandleDevice)
Read a byte from a XP1541/XP1571 cable.
int CBMAPIDECL opencbm_plugin_talk(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress)
Send a TALK on the IEC serial bus.
int xum1541_init(usb_dev_handle **HandleXum1541, int PortNumber)
Initialize the xum1541 device This function tries to find and identify the xum1541 device...
int CBMAPIDECL opencbm_plugin_listen(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress)
Send a LISTEN on the IEC serial bus.
int xum1541_ioctl(usb_dev_handle *HandleXum1541, unsigned int cmd, unsigned int addr, unsigned int secaddr)
Perform an ioctl on the xum1541, which is any command other than read/write or special device managem...
int xum1541_control_msg(usb_dev_handle *HandleXum1541, unsigned int cmd)
Handle synchronous USB control messages, e.g. for RESET. xum1541_ioctl() is used for bulk messages...
int CBMAPIDECL opencbm_plugin_untalk(CBM_FILE HandleDevice)
Send an UNTALK on the IEC serial bus.
int xum1541_read(usb_dev_handle *HandleXum1541, unsigned char mode, unsigned char *data, size_t size)
Read data from the xum1541 device.
void CBMAPIDECL opencbm_plugin_iec_set(CBM_FILE HandleDevice, int Line)
Activate a line on the IEC serial bus.
int CBMAPIDECL opencbm_plugin_iec_poll(CBM_FILE HandleDevice)
Read status of all bus lines.
int CBMAPIDECL opencbm_plugin_get_eoi(CBM_FILE HandleDevice)
Get EOI flag after bus read.
int CBMAPIDECL opencbm_plugin_close(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress)
Close a file on the IEC serial bus.