OpenCBM
|
libusb-based xum1541 access routines More...
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "opencbm.h"
#include "arch.h"
#include "dynlibusb.h"
#include "getpluginaddress.h"
#include "xum1541.h"
Go to the source code of this file.
Macros | |
#define | TAPE_SUPPORT 1 |
#define | LIBUSB_PATH_MAX 512 |
#define | PREFIX_OFFSET (sizeof("libusb/xum1541:") - 1) |
#define | RefuseToWorkInWrongMode |
Functions | |
const char * | xum1541_device_path (int PortNumber) |
Query unique identifier for the xum1541 device This function tries to find an unique identifier for the xum1541 device. More... | |
int | xum1541_init (usb_dev_handle **HandleXum1541, int PortNumber) |
Initialize the xum1541 device This function tries to find and identify the xum1541 device. More... | |
void | xum1541_close (usb_dev_handle *HandleXum1541) |
close the xum1541 device More... | |
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. More... | |
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 management commands such as INIT and RESET. More... | |
int | xum1541_tap_break (usb_dev_handle *HandleXum1541) |
Send tape operations abort command to the xum1541 device. More... | |
int | xum1541_write (usb_dev_handle *HandleXum1541, unsigned char modeFlags, const unsigned char *data, size_t size) |
Write data to the xum1541 device. More... | |
int | xum1541_write_ext (usb_dev_handle *HandleXum1541, unsigned char modeFlags, const unsigned char *data, size_t size, int *Status, int *BytesWritten) |
Wrapper for xum1541_write() forcing xum1541_wait_status(), with additional parameters: More... | |
int | xum1541_read_ext (usb_dev_handle *HandleXum1541, unsigned char mode, unsigned char *data, size_t size, int *Status, int *BytesRead) |
Wrapper for xum1541_read() forcing xum1541_wait_status(), with additional parameters: More... | |
int | xum1541_read (usb_dev_handle *HandleXum1541, unsigned char mode, unsigned char *data, size_t size) |
Read data from the xum1541 device. More... | |
Variables | |
unsigned char | DeviceDriveMode |
#define RefuseToWorkInWrongMode |
void xum1541_close | ( | usb_dev_handle * | HandleXum1541 | ) |
close the xum1541 device
HandleXum1541 | Pointer to a XUM1541_HANDLE which will contain the file handle of the USB device. |
Definition at line 466 of file xum1541.c.
Referenced by opencbm_plugin_driver_close(), xum1541_device_path(), and xum1541_init().
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.
HandleXum1541 | A XUM1541_HANDLE which contains the file handle of the USB device. |
cmd | The command to run. |
Definition at line 499 of file xum1541.c.
Referenced by opencbm_plugin_reset(), xum1541_plugin_control_msg(), and xum1541_tap_break().
const char* xum1541_device_path | ( | int | PortNumber | ) |
Query unique identifier for the xum1541 device This function tries to find an unique identifier for the xum1541 device.
PortNumber | The device's serial number to search for also. It is not considered, if set to 0. |
Definition at line 287 of file xum1541.c.
References xum1541_close().
Referenced by opencbm_plugin_get_driver_name().
int xum1541_init | ( | usb_dev_handle ** | HandleXum1541, |
int | PortNumber | ||
) |
Initialize the xum1541 device This function tries to find and identify the xum1541 device.
HandleXum1541 | Pointer to a XUM1541_HANDLE which will contain the file handle of the USB device. |
PortNumber | The device's serial number to search for also. It is not considered, if set to 0. |
Definition at line 374 of file xum1541.c.
References xum1541_close().
Referenced by opencbm_plugin_driver_open().
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 management commands such as INIT and RESET.
HandleXum1541 | A XUM1541_HANDLE which contains the file handle of the USB device. |
cmd | The command to run. |
addr | The IEC device to use or 0 if not needed. |
secaddr | The IEC secondary address to use or 0 if not needed. |
Definition at line 616 of file xum1541.c.
Referenced by opencbm_plugin_clear_eoi(), opencbm_plugin_get_eoi(), opencbm_plugin_iec_poll(), opencbm_plugin_iec_release(), opencbm_plugin_iec_set(), opencbm_plugin_iec_setrelease(), opencbm_plugin_iec_wait(), opencbm_plugin_pp_read(), and opencbm_plugin_pp_write().
int xum1541_read | ( | usb_dev_handle * | HandleXum1541, |
unsigned char | mode, | ||
unsigned char * | data, | ||
size_t | size | ||
) |
Read data from the xum1541 device.
HandleXum1541 | A XUM1541_HANDLE which contains the file handle of the USB device. |
mode | Drive protocol to use to read the data from the device (e.g, XUM1541_CBM is normal IEC wire protocol). |
data | Pointer to a buffer which will contain the data read from the xum1541 |
size | The number of bytes to read from the xum1541 |
Definition at line 833 of file xum1541.c.
Referenced by opencbm_plugin_nib_read_n(), opencbm_plugin_pp_cc_read_n(), opencbm_plugin_pp_dc_read_n(), opencbm_plugin_raw_read(), opencbm_plugin_s1_read_n(), opencbm_plugin_s2_read_n(), and xum1541_read_ext().
int xum1541_read_ext | ( | usb_dev_handle * | HandleXum1541, |
unsigned char | mode, | ||
unsigned char * | data, | ||
size_t | size, | ||
int * | Status, | ||
int * | BytesRead | ||
) |
Wrapper for xum1541_read() forcing xum1541_wait_status(), with additional parameters:
Status | The return status. |
BytesRead | The number of bytes read. |
Definition at line 801 of file xum1541.c.
References xum1541_read().
int xum1541_tap_break | ( | usb_dev_handle * | HandleXum1541 | ) |
Send tape operations abort command to the xum1541 device.
HandleXum1541 | A XUM1541_HANDLE which contains the file handle of the USB device. |
Definition at line 656 of file xum1541.c.
References xum1541_control_msg().
int xum1541_write | ( | usb_dev_handle * | HandleXum1541, |
unsigned char | modeFlags, | ||
const unsigned char * | data, | ||
size_t | size | ||
) |
Write data to the xum1541 device.
HandleXum1541 | A XUM1541_HANDLE which contains the file handle of the USB device. |
mode | Drive protocol to use to read the data from the device (e.g, XUM1541_CBM is normal IEC wire protocol). |
data | Pointer to buffer which contains the data to be written to the xum1541 |
size | The number of bytes to write to the xum1541 |
Definition at line 686 of file xum1541.c.
Referenced by opencbm_plugin_close(), opencbm_plugin_listen(), opencbm_plugin_nib_write_n(), opencbm_plugin_open(), opencbm_plugin_pp_cc_write_n(), opencbm_plugin_pp_dc_write_n(), opencbm_plugin_raw_write(), opencbm_plugin_s1_write_n(), opencbm_plugin_s2_write_n(), opencbm_plugin_talk(), opencbm_plugin_unlisten(), opencbm_plugin_untalk(), and xum1541_write_ext().
int xum1541_write_ext | ( | usb_dev_handle * | HandleXum1541, |
unsigned char | modeFlags, | ||
const unsigned char * | data, | ||
size_t | size, | ||
int * | Status, | ||
int * | BytesWritten | ||
) |
Wrapper for xum1541_write() forcing xum1541_wait_status(), with additional parameters:
Status | The return status. |
BytesWritten | The number of bytes written. |
Definition at line 775 of file xum1541.c.
References xum1541_write().