13 #include <sys/ioctl.h>
17 #include "cbm_module.h"
19 static char *cbm_dev_name =
"/dev/cbm";
28 *f = open(cbm_dev_name, O_RDWR);
29 return (*f < 0) ? -1 : 0;
92 return write(f, buf, size);
97 return read(f, buf, size);
163 int opencbm_plugin_iec_get(
CBM_FILE f,
int line)
void CBMAPIDECL opencbm_plugin_iec_release(CBM_FILE HandleDevice, int Line)
Deactivate a line on the IEC serial bus.
void CBMAPIDECL opencbm_plugin_driver_close(CBM_FILE HandleDevice)
Closes the driver.
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_driver_open(CBM_FILE *HandleDevice, const char *const Port)
Opens the driver.
int CBMAPIDECL opencbm_plugin_open(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress)
Open a file on the IEC serial bus.
int CBMAPIDECL opencbm_plugin_close(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress)
Close a file on the IEC serial bus.
void CBMAPIDECL opencbm_plugin_iec_set(CBM_FILE HandleDevice, int Line)
Activate a line on the IEC serial bus.
#define CBMCTRL_IEC_SET
IOCTL for setting an IEC line.
#define CBMCTRL_LISTEN
IOCTL for sending a LISTEN command.
int CBMAPIDECL opencbm_plugin_iec_poll(CBM_FILE HandleDevice)
Read status of all bus lines.
#define CBMCTRL_TALK
IOCTL for sending a TALK command.
int CBMAPIDECL opencbm_plugin_unlisten(CBM_FILE HandleDevice)
Send an UNLISTEN on the IEC serial bus.
#define CBMCTRL_UNLISTEN
IOCTL for sending an UNLISTEN command.
#define CBMCTRL_IEC_RELEASE
IOCTL for releasing an IEC line.
#define CBMCTRL_IEC_SETRELEASE
IOCTL for setting and releasing IEC lines at once.
int CBMAPIDECL opencbm_plugin_raw_write(CBM_FILE HandleDevice, const void *Buffer, size_t Count)
Write data to the IEC serial bus.
#define CBMCTRL_GET_EOI
IOCTL for getting the EOI state.
int CBMAPIDECL opencbm_plugin_listen(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress)
Send a LISTEN on the IEC serial bus.
#define CBMCTRL_PP_WRITE
IOCTL for setting the PP values.
void CBMAPIDECL opencbm_plugin_unlock(CBM_FILE HandleDevice)
Unlock the parallel port for the driver.
int CBMAPIDECL opencbm_plugin_reset(CBM_FILE HandleDevice)
RESET all devices.
unsigned char CBMAPIDECL opencbm_plugin_pp_read(CBM_FILE HandleDevice)
Read a byte from a XP1541/XP1571 cable.
void CBMAPIDECL opencbm_plugin_iec_setrelease(CBM_FILE HandleDevice, int Set, int Release)
Activate and deactive a line on the IEC serial bus.
int CBMAPIDECL opencbm_plugin_talk(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress)
Send a TALK on the IEC serial bus.
#define CBMCTRL_UNTALK
IOCTL for sending an UNTALK command.
int CBMAPIDECL opencbm_plugin_untalk(CBM_FILE HandleDevice)
Send an UNTALK on the IEC serial bus.
#define CBMCTRL_PP_READ
IOCTL for reading the PP values.
#define CBMCTRL_RESET
IOCTL for sending a RESET.
int CBMAPIDECL opencbm_plugin_clear_eoi(CBM_FILE HandleDevice)
Reset the EOI flag.
#define CBMCTRL_IEC_POLL
IOCTL for polling an IEC line.
#define CBMCTRL_CLEAR_EOI
IOCTL for resetting the EOI state.
DLL interface for accessing the driver.
int CBMAPIDECL opencbm_plugin_iec_wait(CBM_FILE HandleDevice, int Line, int State)
Wait for a line to have a specific state.
void CBMAPIDECL opencbm_plugin_lock(CBM_FILE HandleDevice)
Lock the parallel port for the driver.
#define CBMCTRL_IEC_WAIT
IOCTL for waiting for an IEC line.
#define CBMCTRL_OPEN
IOCTL for sending an OPEN command.
int CBMAPIDECL opencbm_plugin_get_eoi(CBM_FILE HandleDevice)
Get EOI flag after bus read.
int CBMAPIDECL opencbm_plugin_raw_read(CBM_FILE HandleDevice, void *Buffer, size_t Count)
Read data from the IEC serial bus.
#define CBMCTRL_CLOSE
IOCTL for sending a CLOSE command.
void CBMAPIDECL opencbm_plugin_pp_write(CBM_FILE HandleDevice, unsigned char Byte)
Write a byte to a XP1541/XP1571 cable.