22 #define DBG_PROGNAME "OPENCBM-XUM1541.DLL"
25 #define OPENCBM_PLUGIN
51 result = (
unsigned char)
xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_PARBURST_READ, 0, 0);
76 result =
xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_PARBURST_WRITE, Value, 0);
81 opencbm_plugin_parallel_burst_read_n(
CBM_FILE HandleDevice,
unsigned char *Buffer,
86 result =
xum1541_read((usb_dev_handle *)HandleDevice, XUM1541_NIB_COMMAND, Buffer, Length);
87 if (result != Length) {
95 opencbm_plugin_parallel_burst_write_n(
CBM_FILE HandleDevice,
unsigned char *Buffer,
100 result =
xum1541_write((usb_dev_handle *)HandleDevice, XUM1541_NIB_COMMAND, Buffer, Length);
101 if (result != Length) {
134 result =
xum1541_read((usb_dev_handle *)HandleDevice, XUM1541_NIB, Buffer, Length);
135 if (result != Length) {
170 result =
xum1541_read((usb_dev_handle *)HandleDevice, XUM1541_NIB, Buffer, Length | XUM1541_NIB_READ_VAR);
172 DBG_WARN((
DBG_PREFIX "parallel_burst_read_track_var: returned with error %d", result));
204 result =
xum1541_write((usb_dev_handle *)HandleDevice, XUM1541_NIB, Buffer, Length);
205 if (result != Length) {
230 opencbm_plugin_srq_burst_read(
CBM_FILE HandleDevice)
232 unsigned char result;
234 result = (
unsigned char)
xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_SRQBURST_READ, 0, 0);
254 opencbm_plugin_srq_burst_write(
CBM_FILE HandleDevice,
unsigned char Value)
258 result =
xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_SRQBURST_WRITE, Value, 0);
262 opencbm_plugin_srq_burst_read_n(
CBM_FILE HandleDevice,
unsigned char *Buffer,
267 result =
xum1541_read((usb_dev_handle *)HandleDevice, XUM1541_NIB_SRQ_COMMAND, Buffer, Length);
268 if (result != Length) {
276 opencbm_plugin_srq_burst_write_n(
CBM_FILE HandleDevice,
unsigned char *Buffer,
281 result =
xum1541_write((usb_dev_handle *)HandleDevice, XUM1541_NIB_SRQ_COMMAND, Buffer, Length);
282 if (result != Length) {
311 opencbm_plugin_srq_burst_read_track(
CBM_FILE HandleDevice,
unsigned char *Buffer,
unsigned int Length)
315 result =
xum1541_read((usb_dev_handle *)HandleDevice, XUM1541_NIB_SRQ, Buffer, Length);
316 if (result != Length) {
345 opencbm_plugin_srq_burst_write_track(
CBM_FILE HandleDevice,
unsigned char *Buffer,
unsigned int Length)
349 result =
xum1541_write((usb_dev_handle *)HandleDevice, XUM1541_NIB_SRQ, Buffer, Length);
350 if (result != Length) {
377 opencbm_plugin_tap_prepare_capture(
CBM_FILE HandleDevice,
int *Status)
379 *Status =
xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_TAP_PREPARE_CAPTURE, 0, 0);
402 opencbm_plugin_tap_prepare_write(
CBM_FILE HandleDevice,
int *Status)
404 *Status =
xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_TAP_PREPARE_WRITE, 0, 0);
427 opencbm_plugin_tap_get_sense(
CBM_FILE HandleDevice,
int *Status)
429 *Status =
xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_TAP_GET_SENSE, 0, 0);
452 opencbm_plugin_tap_wait_for_stop_sense(
CBM_FILE HandleDevice,
int *Status)
454 *Status =
xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_TAP_WAIT_FOR_STOP_SENSE, 0, 0);
477 opencbm_plugin_tap_wait_for_play_sense(
CBM_FILE HandleDevice,
int *Status)
479 *Status =
xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_TAP_WAIT_FOR_PLAY_SENSE, 0, 0);
502 opencbm_plugin_tap_motor_on(
CBM_FILE HandleDevice,
int *Status)
504 *Status =
xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_TAP_MOTOR_ON, 0, 0);
527 opencbm_plugin_tap_motor_off(
CBM_FILE HandleDevice,
int *Status)
529 *Status =
xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_TAP_MOTOR_OFF, 0, 0);
564 opencbm_plugin_tap_start_capture(
CBM_FILE HandleDevice,
unsigned char *Buffer,
unsigned int Buffer_Length,
int *Status,
int *BytesRead)
566 int result =
xum1541_read_ext((usb_dev_handle *)HandleDevice, XUM1541_TAP, Buffer, Buffer_Length, Status, BytesRead);
568 DBG_WARN((
DBG_PREFIX "opencbm_plugin_tap_start_capture: returned with error %d", result));
603 opencbm_plugin_tap_start_write(
CBM_FILE HandleDevice,
unsigned char *Buffer,
unsigned int Length,
int *Status,
int *BytesWritten)
605 int result =
xum1541_write_ext((usb_dev_handle *)HandleDevice, XUM1541_TAP, Buffer, Length, Status, BytesWritten);
607 DBG_WARN((
DBG_PREFIX "opencbm_plugin_tap_start_write: returned with error %d", result));
630 opencbm_plugin_tap_get_ver(
CBM_FILE HandleDevice,
int *Status)
632 *Status =
xum1541_ioctl((usb_dev_handle *)HandleDevice, XUM1541_TAP_GET_VER, 0, 0);
638 opencbm_plugin_tap_break(
CBM_FILE HandleDevice)
674 opencbm_plugin_tap_download_config(
CBM_FILE HandleDevice,
unsigned char *Buffer,
unsigned int Buffer_Length,
int *Status,
int *BytesRead)
676 int result =
xum1541_read_ext((usb_dev_handle *)HandleDevice, XUM1541_TAP_CONFIG, Buffer, Buffer_Length, Status, BytesRead);
678 DBG_WARN((
DBG_PREFIX "opencbm_plugin_tap_download_config: returned with error %d", result));
713 opencbm_plugin_tap_upload_config(
CBM_FILE HandleDevice,
unsigned char *Buffer,
unsigned int Length,
int *Status,
int *BytesWritten)
715 int result =
xum1541_write_ext((usb_dev_handle *)HandleDevice, XUM1541_TAP_CONFIG, Buffer, Length, Status, BytesWritten);
717 DBG_WARN((
DBG_PREFIX "opencbm_plugin_tap_upload_config: returned with error %d", result));
void CBMAPIDECL opencbm_plugin_parallel_burst_write(CBM_FILE HandleDevice, unsigned char Value)
PARBURST: Write to the parallel port.
Define makros for debugging purposes.
int xum1541_tap_break(usb_dev_handle *HandleXum1541)
Send tape operations abort command to the xum1541 device.
unsigned char CBMAPIDECL opencbm_plugin_parallel_burst_read(CBM_FILE HandleDevice)
PARBURST: Read from the parallel port.
int CBMAPIDECL opencbm_plugin_parallel_burst_read_track(CBM_FILE HandleDevice, unsigned char *Buffer, unsigned int Length)
PARBURST: Read a complete track.
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_parallel_burst_read_track_var(CBM_FILE HandleDevice, unsigned char *Buffer, unsigned int Length)
PARBURST: Read a variable length track.
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: ...
int CBMAPIDECL opencbm_plugin_parallel_burst_write_track(CBM_FILE HandleDevice, unsigned char *Buffer, unsigned int Length)
PARBURST: Write a complete track.
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: ...
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_read(usb_dev_handle *HandleXum1541, unsigned char mode, unsigned char *data, size_t size)
Read data from the xum1541 device.