OpenCBM
Macros | Enumerations | Functions
opencbm.h File Reference

DLL interface for accessing the driver. More...

#include <sys/types.h>
#include <stdint.h>

Go to the source code of this file.

Macros

#define EXTERN   extern
 
#define CBMAPIDECL
 
#define WINAPI
 
#define CBM_FILE   intptr_t
 
#define CBM_FILE_INVALID   ((CBM_FILE)-1)
 
#define UNREFERENCED_PARAMETER(x)
 
#define IEC_DATA   0x01
 
#define IEC_CLOCK   0x02
 
#define IEC_ATN   0x04
 
#define IEC_RESET   0x08
 
#define IEC_SRQ   0x10
 
#define IEE_NDAC   0x01
 
#define IEE_NRFD   0x02
 
#define IEE_ATN   0x04
 
#define IEE_IFC   0x08
 
#define IEE_DAV   0x10
 
#define IEE_EOI   0x20
 
#define IEE_REN   0x40
 
#define IEE_SRQ   0x80
 

Enumerations

enum  cbm_device_type_e {
  cbm_dt_unknown = -1, cbm_dt_cbm1541, cbm_dt_cbm1570, cbm_dt_cbm1571,
  cbm_dt_cbm1581, cbm_dt_cbm2040, cbm_dt_cbm2031, cbm_dt_cbm3040,
  cbm_dt_cbm4040, cbm_dt_cbm4031, cbm_dt_cbm8050, cbm_dt_cbm8250,
  cbm_dt_sfd1001
}
 
enum  cbm_cable_type_e { cbm_ct_unknown = -1, cbm_ct_none, cbm_ct_xp1541 }
 

Functions

EXTERN int CBMAPIDECL cbm_driver_open (CBM_FILE *f, int port)
 Opens the driver. More...
 
EXTERN int CBMAPIDECL cbm_driver_open_ex (CBM_FILE *f, char *adapter)
 Opens the driver, extended version. More...
 
EXTERN void CBMAPIDECL cbm_driver_close (CBM_FILE f)
 Closes the driver. More...
 
EXTERN void CBMAPIDECL cbm_lock (CBM_FILE f)
 Lock the parallel port for the driver. More...
 
EXTERN void CBMAPIDECL cbm_unlock (CBM_FILE f)
 Unlock the parallel port for the driver. More...
 
EXTERN const char *CBMAPIDECL cbm_get_driver_name (int port)
 Get the name of the driver for a specific parallel port. More...
 
EXTERN const char *CBMAPIDECL cbm_get_driver_name_ex (char *adapter)
 Get the name of the driver for a specific parallel port, extended version. More...
 
EXTERN int CBMAPIDECL cbm_listen (CBM_FILE f, unsigned char dev, unsigned char secadr)
 Send a LISTEN on the IEC serial bus. More...
 
EXTERN int CBMAPIDECL cbm_talk (CBM_FILE f, unsigned char dev, unsigned char secadr)
 Send a TALK on the IEC serial bus. More...
 
EXTERN int CBMAPIDECL cbm_open (CBM_FILE f, unsigned char dev, unsigned char secadr, const void *fname, size_t len)
 Open a file on the IEC serial bus. More...
 
EXTERN int CBMAPIDECL cbm_close (CBM_FILE f, unsigned char dev, unsigned char secadr)
 Close a file on the IEC serial bus. More...
 
EXTERN int CBMAPIDECL cbm_raw_read (CBM_FILE f, void *buf, size_t size)
 Read data from the IEC serial bus. More...
 
EXTERN int CBMAPIDECL cbm_raw_write (CBM_FILE f, const void *buf, size_t size)
 Write data to the IEC serial bus. More...
 
EXTERN int CBMAPIDECL cbm_unlisten (CBM_FILE f)
 Send an UNLISTEN on the IEC serial bus. More...
 
EXTERN int CBMAPIDECL cbm_untalk (CBM_FILE f)
 Send an UNTALK on the IEC serial bus. More...
 
EXTERN int CBMAPIDECL cbm_get_eoi (CBM_FILE f)
 Get EOI flag after bus read. More...
 
EXTERN int CBMAPIDECL cbm_clear_eoi (CBM_FILE f)
 Reset the EOI flag. More...
 
EXTERN int CBMAPIDECL cbm_reset (CBM_FILE f)
 RESET all devices. More...
 
EXTERN unsigned char CBMAPIDECL cbm_pp_read (CBM_FILE f)
 Read a byte from a XP1541/XP1571 cable. More...
 
EXTERN void CBMAPIDECL cbm_pp_write (CBM_FILE f, unsigned char c)
 Write a byte to a XP1541/XP1571 cable. More...
 
EXTERN int CBMAPIDECL cbm_iec_poll (CBM_FILE f)
 Read status of all bus lines. More...
 
EXTERN int CBMAPIDECL cbm_iec_get (CBM_FILE f, int line)
 Get the (logical) state of a line on the IEC serial bus. More...
 
EXTERN void CBMAPIDECL cbm_iec_set (CBM_FILE f, int line)
 Activate a line on the IEC serial bus. More...
 
EXTERN void CBMAPIDECL cbm_iec_release (CBM_FILE f, int line)
 Deactivate a line on the IEC serial bus. More...
 
EXTERN void CBMAPIDECL cbm_iec_setrelease (CBM_FILE f, int set, int release)
 Activate and deactive a line on the IEC serial bus. More...
 
EXTERN int CBMAPIDECL cbm_iec_wait (CBM_FILE f, int line, int state)
 Wait for a line to have a specific state. More...
 
EXTERN int CBMAPIDECL cbm_upload (CBM_FILE f, unsigned char dev, int adr, const void *prog, size_t size)
 Upload a program into a floppy's drive memory. More...
 
EXTERN int CBMAPIDECL cbm_download (CBM_FILE f, unsigned char dev, int adr, void *dbuf, size_t size)
 
EXTERN int CBMAPIDECL cbm_device_status (CBM_FILE f, unsigned char dev, void *buf, size_t bufsize)
 Read the drive status from a floppy. More...
 
EXTERN int CBMAPIDECL cbm_exec_command (CBM_FILE f, unsigned char dev, const void *cmd, size_t len)
 Executes a command in the floppy drive. More...
 
EXTERN int CBMAPIDECL cbm_identify (CBM_FILE f, unsigned char drv, enum cbm_device_type_e *t, const char **type_str)
 Identify the connected floppy drive. More...
 
EXTERN int CBMAPIDECL cbm_identify_xp1541 (CBM_FILE HandleDevice, unsigned char DeviceAddress, enum cbm_device_type_e *CbmDeviceType, enum cbm_cable_type_e *CableType)
 Identify the cable connected to a specific floppy drive. More...
 
EXTERN char CBMAPIDECL cbm_petscii2ascii_c (char character)
 Convert a PETSCII character to ASCII. More...
 
EXTERN char CBMAPIDECL cbm_ascii2petscii_c (char character)
 Convert an ASCII character to PETSCII. More...
 
EXTERN char *CBMAPIDECL cbm_petscii2ascii (char *str)
 Convert an null-termined PETSCII string to ASCII. More...
 
EXTERN char *CBMAPIDECL cbm_ascii2petscii (char *str)
 Convert an null-termined ASCII string to PETSCII. More...
 
EXTERN int CBMAPIDECL gcr_5_to_4_decode (const unsigned char *source, unsigned char *dest, size_t sourceLength, size_t destLength)
 Decode GCR data. More...
 
EXTERN int CBMAPIDECL gcr_4_to_5_encode (const unsigned char *source, unsigned char *dest, size_t sourceLength, size_t destLength)
 Encode GCR data. More...
 
EXTERN int CBMAPIDECL cbm_get_debugging_buffer (CBM_FILE HandleDevice, char *buffer, size_t len)
 Output contents of the debugging buffer. More...
 
EXTERN int CBMAPIDECL cbm_iec_dbg_read (CBM_FILE HandleDevice)
 Read a byte from the parallel port input register. More...
 
EXTERN int CBMAPIDECL cbm_iec_dbg_write (CBM_FILE HandleDevice, unsigned char Value)
 Write a byte to the parallel port output register. More...
 
EXTERN unsigned char CBMAPIDECL cbm_parallel_burst_read (CBM_FILE f)
 PARBURST: Read from the parallel port. More...
 
EXTERN void CBMAPIDECL cbm_parallel_burst_write (CBM_FILE f, unsigned char c)
 PARBURST: Write to the parallel port. More...
 
EXTERN int CBMAPIDECL cbm_parallel_burst_read_n (CBM_FILE HandleDevice, unsigned char *Buffer, unsigned int Length)
 
EXTERN int CBMAPIDECL cbm_parallel_burst_write_n (CBM_FILE HandleDevice, unsigned char *Buffer, unsigned int Length)
 
EXTERN int CBMAPIDECL cbm_parallel_burst_read_track (CBM_FILE f, unsigned char *buffer, unsigned int length)
 PARBURST: Read a complete track. More...
 
EXTERN int CBMAPIDECL cbm_parallel_burst_read_track_var (CBM_FILE f, unsigned char *buffer, unsigned int length)
 PARBURST: Read a variable length track. More...
 
EXTERN int CBMAPIDECL cbm_parallel_burst_write_track (CBM_FILE f, unsigned char *buffer, unsigned int length)
 PARBURST: Write a complete track. More...
 
EXTERN unsigned char CBMAPIDECL cbm_srq_burst_read (CBM_FILE f)
 PARBURST: Read from the parallel port. More...
 
EXTERN void CBMAPIDECL cbm_srq_burst_write (CBM_FILE f, unsigned char c)
 PARBURST: Write to the parallel port. More...
 
EXTERN int CBMAPIDECL cbm_srq_burst_read_n (CBM_FILE HandleDevice, unsigned char *Buffer, unsigned int Length)
 
EXTERN int CBMAPIDECL cbm_srq_burst_write_n (CBM_FILE HandleDevice, unsigned char *Buffer, unsigned int Length)
 
EXTERN int CBMAPIDECL cbm_srq_burst_read_track (CBM_FILE f, unsigned char *buffer, unsigned int length)
 PARBURST: Read a complete track. More...
 
EXTERN int CBMAPIDECL cbm_srq_burst_write_track (CBM_FILE f, unsigned char *buffer, unsigned int length)
 PARBURST: Write a complete track. More...
 
EXTERN int CBMAPIDECL cbm_tap_prepare_capture (CBM_FILE f, int *Status)
 TAPE: Prepare capture. More...
 
EXTERN int CBMAPIDECL cbm_tap_prepare_write (CBM_FILE f, int *Status)
 TAPE: Prepare write. More...
 
EXTERN int CBMAPIDECL cbm_tap_get_sense (CBM_FILE f, int *Status)
 TAPE: Get tape sense. More...
 
EXTERN int CBMAPIDECL cbm_tap_wait_for_stop_sense (CBM_FILE f, int *Status)
 TAPE: Wait for <STOP> sense. More...
 
EXTERN int CBMAPIDECL cbm_tap_wait_for_play_sense (CBM_FILE f, int *Status)
 TAPE: Wait for <PLAY> sense. More...
 
EXTERN int CBMAPIDECL cbm_tap_start_capture (CBM_FILE f, unsigned char *Buffer, unsigned int Buffer_Length, int *Status, int *BytesRead)
 TAPE: Start capture. More...
 
EXTERN int CBMAPIDECL cbm_tap_start_write (CBM_FILE f, unsigned char *Buffer, unsigned int Length, int *Status, int *BytesWritten)
 TAPE: Start write. More...
 
EXTERN int CBMAPIDECL cbm_tap_motor_on (CBM_FILE f, int *Status)
 TAPE: Motor on. More...
 
EXTERN int CBMAPIDECL cbm_tap_motor_off (CBM_FILE f, int *Status)
 TAPE: Motor off. More...
 
EXTERN int CBMAPIDECL cbm_tap_get_ver (CBM_FILE f, int *Status)
 TAPE: Return tape firmware version. More...
 
EXTERN int CBMAPIDECL cbm_tap_download_config (CBM_FILE f, unsigned char *Buffer, unsigned int Buffer_Length, int *Status, int *BytesRead)
 TAPE: Download configuration. More...
 
EXTERN int CBMAPIDECL cbm_tap_upload_config (CBM_FILE f, unsigned char *Buffer, unsigned int Length, int *Status, int *BytesWritten)
 TAPE: Upload configuration. More...
 
EXTERN int CBMAPIDECL cbm_tap_break (CBM_FILE f)
 
EXTERN void *CBMAPIDECL cbm_get_plugin_function_address (const char *Functionname)
 Get the function pointer for a function in a plugin. More...
 

Detailed Description

DLL interface for accessing the driver.



Author
Michael Klein <michael(dot)klein(at)puffin(dot)lb(dot)shuttle(dot)de>
Authors
With modifications to fit on Windows from Spiro Trikaliotis
With additions from Wolfgang Moser
With CBM 1530/1531 tape drive additions from Arnd Menge

Definition in file opencbm.h.

Macro Definition Documentation

#define CBM_FILE   intptr_t

The "file descriptor" for an opened driver

Definition at line 87 of file opencbm.h.

Referenced by cbm_driver_install(), main(), vdd_cbmfile_delete(), vdd_cbmfile_get(), vdd_driver_open(), and VDDDispatch().

#define CBM_FILE_INVALID   ((CBM_FILE)-1)

An invalid "file descriptor" (CBM_FILE)

Definition at line 88 of file opencbm.h.

#define CBMAPIDECL

CBMAPIDECL is a dummy on Linux

Definition at line 85 of file opencbm.h.

#define EXTERN   extern

EXTERN is not defined on Linux

Definition at line 84 of file opencbm.h.

#define IEC_ATN   0x04

Specify the ATN line

Definition at line 99 of file opencbm.h.

Referenced by DllMain().

#define IEC_CLOCK   0x02

Specify the CLOCK line

Definition at line 98 of file opencbm.h.

Referenced by DllMain().

#define IEC_DATA   0x01

Specify the DATA line

Definition at line 97 of file opencbm.h.

Referenced by DllMain().

#define IEC_RESET   0x08

Specify the RESET line

Definition at line 100 of file opencbm.h.

Referenced by DllMain().

#define IEC_SRQ   0x10

Specify the SRQ line

Definition at line 101 of file opencbm.h.

#define IEE_ATN   0x04

Specify the ATN line

Definition at line 106 of file opencbm.h.

#define IEE_DAV   0x10

Specify the DAV line

Definition at line 108 of file opencbm.h.

#define IEE_EOI   0x20

Specify the EOI line

Definition at line 109 of file opencbm.h.

#define IEE_IFC   0x08

Specify the IFC line

Definition at line 107 of file opencbm.h.

#define IEE_NDAC   0x01

Specify the NDAC line

Definition at line 104 of file opencbm.h.

#define IEE_NRFD   0x02

Specify the NRFD line

Definition at line 105 of file opencbm.h.

#define IEE_REN   0x40

Specify the REN line

Definition at line 110 of file opencbm.h.

#define IEE_SRQ   0x80

Specify the SRQ line

Definition at line 111 of file opencbm.h.

#define WINAPI

WINAPI is a dummy on Linux

Definition at line 86 of file opencbm.h.

Enumeration Type Documentation

Specifies the type of a device for cbm_identify()

Enumerator
cbm_ct_unknown 

The device could not be identified

cbm_ct_none 

The device does not have a parallel cable

cbm_ct_xp1541 

The device does have a parallel cable

Definition at line 132 of file opencbm.h.

Specifies the type of a device for cbm_identify()

Enumerator
cbm_dt_unknown 

The device could not be identified

cbm_dt_cbm1541 

The device is a VIC 1541

cbm_dt_cbm1570 

The device is a VIC 1570

cbm_dt_cbm1571 

The device is a VIC 1571

cbm_dt_cbm1581 

The device is a VIC 1581

cbm_dt_cbm2040 

The device is a CBM-2040 DOS1 or 2

cbm_dt_cbm2031 

The device is a CBM-2031 DOS2.6

cbm_dt_cbm3040 

The device is a CBM-3040 DOS1 or 2

cbm_dt_cbm4040 

The device is a CBM-4040 DOS2

cbm_dt_cbm4031 

The device is a CBM-4031 DOS2.6

cbm_dt_cbm8050 

The device is a CBM-8050

cbm_dt_cbm8250 

The device is a CBM-8250 or SFD-1001

cbm_dt_sfd1001 

The device is a SFD-1001

Definition at line 114 of file opencbm.h.

Function Documentation

EXTERN char* CBMAPIDECL cbm_ascii2petscii ( char *  Str)

Convert an null-termined ASCII string to PETSCII.

This function converts a string in ASCII to PETSCII.

Parameters
StrPointer to a buffer which holds a null-termined string in ASCII.
Returns
Returns a pointer to the Str itself, converted to PETSCII.

Definition at line 160 of file petscii.c.

References cbm_ascii2petscii_c().

EXTERN char CBMAPIDECL cbm_ascii2petscii_c ( char  Character)

Convert an ASCII character to PETSCII.

This function converts a character in ASCII to PETSCII.

Parameters
CharacterThe character value to be converted in ASCII
Returns
Returns the value of character in PETSCII.

Definition at line 105 of file petscii.c.

Referenced by cbm_ascii2petscii().

EXTERN int CBMAPIDECL cbm_clear_eoi ( CBM_FILE  HandleDevice)

Reset the EOI flag.

This function resets the EOI ("End of Information") flag which might be still set after reading the IEC serial bus.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
0 on success, != 0 means an error has occured.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1180 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_clear_eoi, and plugin_information_s::Plugin.

Referenced by vdd_clear_eoi().

EXTERN int CBMAPIDECL cbm_close ( CBM_FILE  HandleDevice,
unsigned char  DeviceAddress,
unsigned char  SecondaryAddress 
)

Close a file on the IEC serial bus.

This function closes a file on the IEC serial bus.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
DeviceAddressThe address of the device on the IEC serial bus. This is known as primary address, too.
SecondaryAddressThe secondary address for the device on the IEC serial bus.
Returns
0 on success, else failure

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1072 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_close, and plugin_information_s::Plugin.

Referenced by vdd_close().

EXTERN int CBMAPIDECL cbm_device_status ( CBM_FILE  HandleDevice,
unsigned char  DeviceAddress,
void *  Buffer,
size_t  BufferLength 
)

Read the drive status from a floppy.

This function reads the drive status of a connected floppy drive.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
DeviceAddressThe address of the device on the IEC serial bus. This is known as primary address, too.
BufferPointer to a buffer which will hold the drive's status after successfull calling,
BufferLengthThe length of the buffer pointed to by Buffer in bytes.
Returns
Returns the int representation of the drive status, that is, the numerical value of the first return value from the drive. This is the error number.

This function will never write more than BufferLength bytes. Nevertheless, the buffer will always be terminated with a trailing zero.

If an error occurs, this function returns a "99, DRIVER ERROR,00,00\r" and the value 99.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1525 of file cbm.c.

References cbm_raw_read(), cbm_talk(), cbm_untalk(), DBG_ASSERT, FUNC_ENTER, and FUNC_LEAVE_INT.

Referenced by vdd_device_status().

EXTERN void CBMAPIDECL cbm_driver_close ( CBM_FILE  HandleDevice)

Closes the driver.

Closes the driver, which has be opened with cbm_driver_open() before.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.

cbm_driver_close() should be called to balance a previous call to cbm_driver_open().

If cbm_driver_open() did not succeed, it is illegal to call cbm_driver_close().

Definition at line 768 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE, opencbm_plugin_s::opencbm_plugin_driver_close, and plugin_information_s::Plugin.

Referenced by vdd_cbmfile_closeall(), vdd_driver_close(), and vdd_driver_open().

EXTERN int CBMAPIDECL cbm_driver_open ( CBM_FILE HandleDevice,
int  PortNumber 
)

Opens the driver.

Todo:
FIXME: port isn't used yet

This function Opens the driver.

Parameters
HandleDevicePointer to a CBM_FILE which will contain the file handle of the driver.
PortNumberThe port number of the driver to open. 0 means "default" driver, while values != 0 enumerate each driver.
Returns
==0: This function completed successfully !=0: otherwise

PortNumber is not allowed to exceed 10.

Note
Do not use this function. It is only available for compatibility reasons with older applications. Use cbm_driver_open_ex() instead!

cbm_driver_open() should be balanced with cbm_driver_close().

Definition at line 740 of file cbm.c.

References cbm_driver_open_ex(), FUNC_ENTER, and FUNC_LEAVE_INT.

Referenced by vdd_driver_open().

EXTERN int CBMAPIDECL cbm_driver_open_ex ( CBM_FILE HandleDevice,
char *  Adapter 
)

Opens the driver, extended version.

This function Opens the driver.

Parameters
HandleDevicePointer to a CBM_FILE which will contain the file handle of the driver.
AdapterThe name of the adapter to be used. The format is given in the documentation for cbm_split_adapter_in_name_and_port().
Returns
==0: This function completed successfully !=0: otherwise
Remarks
cbm_driver_open_ex() should be balanced with cbm_driver_close().

Definition at line 683 of file cbm.c.

References cbmlibmisc_strfree(), DBG_PREFIX, DBG_PRINT, FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_driver_open, and plugin_information_s::Plugin.

Referenced by cbm_driver_open().

EXTERN int CBMAPIDECL cbm_exec_command ( CBM_FILE  HandleDevice,
unsigned char  DeviceAddress,
const void *  Command,
size_t  Size 
)

Executes a command in the floppy drive.

This function Executes a command in the connected floppy drive.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
DeviceAddressThe address of the device on the IEC serial bus. This is known as primary address, too.
CommandPointer to a string which holds the command to be executed.
SizeThe length of the command in bytes. If zero, the Command has to be a null-terminated string.
Returns
0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1599 of file cbm.c.

References cbm_listen(), cbm_raw_write(), cbm_unlisten(), FUNC_ENTER, and FUNC_LEAVE_INT.

Referenced by cbm_identify(), and vdd_exec_command().

EXTERN int CBMAPIDECL cbm_get_debugging_buffer ( CBM_FILE  HandleDevice,
char *  buffer,
size_t  len 
)

Output contents of the debugging buffer.

This function outputs the contents of the kernel-mode debugging buffer to the screen.

This function is for use of the installation routines only!

Definition at line 991 of file WINDOWS/iec.c.

References cbm_ioctl(), CBMCTRL, FUNC_ENTER, and FUNC_LEAVE_INT.

EXTERN const char* CBMAPIDECL cbm_get_driver_name ( int  PortNumber)

Get the name of the driver for a specific parallel port.

Todo:
FIXME: port isn't used yet

Get the name of the driver for a specific parallel port.

Parameters
PortNumberThe port number for the driver to open. 0 means "default" driver, while values != 0 enumerate each driver.
Returns
Returns a pointer to a null-terminated string containing the driver name, or NULL if an error occurred.
Bug:
PortNumber is not allowed to exceed 10.
Note
Do not use this function. It is only there for compatibility reasons with older applications. Use cbm_get_driver_name_ex() instead!

Definition at line 650 of file cbm.c.

References cbm_get_driver_name_ex(), FUNC_ENTER, and FUNC_LEAVE_STRING.

Referenced by vdd_get_driver_name().

EXTERN const char* CBMAPIDECL cbm_get_driver_name_ex ( char *  Adapter)

Get the name of the driver for a specific parallel port, extended version.

Get the name of the driver for a specific parallel port.

Parameters
AdapterThe name of the adapter to be used. The format is given in the documentation for cbm_split_adapter_in_name_and_port().
Returns
Returns a pointer to a null-terminated string containing the driver name, or NULL if an error occurred.

Definition at line 583 of file cbm.c.

References cbmlibmisc_strdup(), cbmlibmisc_strfree(), DBG_PREFIX, DBG_PRINT, FUNC_ENTER, FUNC_LEAVE_STRING, opencbm_plugin_s::opencbm_plugin_get_driver_name, and plugin_information_s::Plugin.

Referenced by cbm_get_driver_name().

EXTERN int CBMAPIDECL cbm_get_eoi ( CBM_FILE  HandleDevice)

Get EOI flag after bus read.

This function gets the EOI ("End of Information") flag after reading the IEC serial bus.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
!= 0 if EOI was signalled, else 0.

If a previous read returned less than the specified number of bytes, there are two possible reasons: Either an error occurred on the IEC serial bus, or an EOI was signalled. To find out the cause, check with this function.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1157 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_get_eoi, and plugin_information_s::Plugin.

Referenced by vdd_get_eoi().

EXTERN void* CBMAPIDECL cbm_get_plugin_function_address ( const char *  Functionname)

Get the function pointer for a function in a plugin.

This function gets the function pointer for a function which resides in the plugin.

Parameters
FunctionnameThe name of the function of which to get the address
Returns
Pointer to the function if successfull; 0 if not.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 2449 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_PTR, plugin_information_s::Library, and plugin_get_address().

EXTERN int CBMAPIDECL cbm_identify ( CBM_FILE  HandleDevice,
unsigned char  DeviceAddress,
enum cbm_device_type_e CbmDeviceType,
const char **  CbmDeviceString 
)

Identify the connected floppy drive.

This function tries to identify a connected floppy drive. For this, it performs some M-R operations.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
DeviceAddressThe address of the device on the IEC serial bus. This is known as primary address, too.
CbmDeviceTypePointer to an enum which will hold the type of the device.
CbmDeviceStringPointer to a pointer which will point on a string which tells the name of the device.
Returns
0 if the drive could be contacted. It does not mean that the device could be identified.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 66 of file detect.c.

References cbm_dt_cbm1541, cbm_dt_cbm1570, cbm_dt_cbm1571, cbm_dt_cbm1581, cbm_dt_cbm3040, cbm_dt_cbm4040, cbm_dt_cbm8050, cbm_dt_cbm8250, cbm_dt_unknown, cbm_exec_command(), cbm_raw_read(), cbm_talk(), cbm_untalk(), FUNC_ENTER, and FUNC_LEAVE_INT.

Referenced by cbm_identify_xp1541(), and vdd_identify().

EXTERN int CBMAPIDECL cbm_identify_xp1541 ( CBM_FILE  HandleDevice,
unsigned char  DeviceAddress,
enum cbm_device_type_e CbmDeviceType,
enum cbm_cable_type_e CableType 
)

Identify the cable connected to a specific floppy drive.

This function tries to identify if the given floppy drive has an XP1541 cable connected.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
DeviceAddressThe address of the device on the IEC serial bus. This is known as primary address, too.
CbmDeviceTypePointer to an enum which holds the type of the device. If this pointer is NULL or the device type is set to unknown, this function calls cbm_identify itself to find out the device type. If this pointer is not set to NULL, this function will return the device type there.
CableTypePointer to an enum which will hold the cable type of the device on return.
Returns
0 if the drive could be contacted. It does not mean that the device could be identified.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 187 of file detectxp1541.c.

References cbm_ct_none, cbm_ct_unknown, cbm_ct_xp1541, cbm_dt_cbm1541, cbm_dt_cbm1570, cbm_dt_cbm1571, cbm_dt_unknown, cbm_identify(), cbm_pp_read(), DBG_ASSERT, DBG_PREFIX, DBG_PRINT, FUNC_ENTER, and FUNC_LEAVE_INT.

Referenced by vdd_identify_xp1541().

EXTERN int CBMAPIDECL cbm_iec_dbg_read ( CBM_FILE  HandleDevice)

Read a byte from the parallel port input register.

This function reads a byte from the parallel port input register. (STATUS_PORT). It is a helper function for debugging the cable (i.e., for the XCDETECT tool) only!

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
If the routine succeeds, it returns a non-negative value which corresponds to the data in the parallel port input register (status port).

If the routine fails, the return value is -1.

Remarks
Do not use this function in anything but a debugging aid tool like XCDETECT!

This functions masks some bits off. The bits that are not masked off are defined in PARALLEL_STATUS_PORT_MASK_VALUES.

Definition at line 2485 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_iec_dbg_read, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_iec_dbg_write ( CBM_FILE  HandleDevice,
unsigned char  Value 
)

Write a byte to the parallel port output register.

This function writes a byte to the parallel port output register. (CONTROL_PORT). It is a helper function for debugging the cable (i.e., for the XCDETECT tool) only!

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
ValueThe value to set the control port to
Returns
If the routine succeeds, it returns 0.

If the routine fails, it returns -1.

Remarks
Do not use this function in anything but a debugging aid tool like XCDETECT!

After this function has been called, it is NOT safe to use the parallel port again unless you close the driver (cbm_driver_close()) and open it again (cbm_driver_open())!

This functions masks some bits off. That is, the bits not in the mask are not changed at all. The bits that are not masked off are defined in PARALLEL_CONTROL_PORT_MASK_VALUES.

Definition at line 2528 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_iec_dbg_write, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_iec_get ( CBM_FILE  HandleDevice,
int  Line 
)

Get the (logical) state of a line on the IEC serial bus.

This function gets the (logical) state of a line on the IEC serial bus.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
LineThe line to be tested. This must be exactly one of IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET.
Returns
1 if the line is set, 0 if it is not

If cbm_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 1477 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_iec_poll, and plugin_information_s::Plugin.

Referenced by vdd_iec_get().

EXTERN int CBMAPIDECL cbm_iec_poll ( CBM_FILE  HandleDevice)

Read status of all bus lines.

This function reads the state of all lines on the IEC serial bus.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
The state of the lines. The result is an OR between the bit flags IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET.

This function just reads the port. No handshaking is performed at all.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 1314 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_iec_poll, and plugin_information_s::Plugin.

Referenced by vdd_iec_poll().

EXTERN void CBMAPIDECL cbm_iec_release ( CBM_FILE  HandleDevice,
int  Line 
)

Deactivate a line on the IEC serial bus.

This function deactivates (sets to 5V) a line on the IEC serial bus.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
LineThe line to be deactivated. This must be exactly one of IEC_DATA, IEC_CLOCK, IEC_ATN, or IEC_RESET.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 1372 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE, opencbm_plugin_s::opencbm_plugin_iec_release, opencbm_plugin_s::opencbm_plugin_iec_setrelease, and plugin_information_s::Plugin.

Referenced by vdd_iec_release().

EXTERN void CBMAPIDECL cbm_iec_set ( CBM_FILE  HandleDevice,
int  Line 
)

Activate a line on the IEC serial bus.

This function activates (sets to 0V) a line on the IEC serial bus.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
LineThe line to be activated. This must be exactly one of IEC_DATA, IEC_CLOCK, IEC_ATN, or IEC_RESET.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 1341 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE, opencbm_plugin_s::opencbm_plugin_iec_set, opencbm_plugin_s::opencbm_plugin_iec_setrelease, and plugin_information_s::Plugin.

Referenced by vdd_iec_set().

EXTERN void CBMAPIDECL cbm_iec_setrelease ( CBM_FILE  HandleDevice,
int  Set,
int  Release 
)

Activate and deactive a line on the IEC serial bus.

This function activates (sets to 0V, L) and deactivates (set to 5V, H) lines on the IEC serial bus.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
SetThe mask of which lines should be set. This has to be a bitwise OR between the constants IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET
ReleaseThe mask of which lines should be released. This has to be a bitwise OR between the constants IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET

If cbm_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!
Remarks
If a bit is specified in the Set as well as in the Release mask, the effect is undefined.

Definition at line 1412 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE, opencbm_plugin_s::opencbm_plugin_iec_setrelease, and plugin_information_s::Plugin.

Referenced by vdd_iec_setrelease().

EXTERN int CBMAPIDECL cbm_iec_wait ( CBM_FILE  HandleDevice,
int  Line,
int  State 
)

Wait for a line to have a specific state.

This function waits for a line to enter a specific state on the IEC serial bus.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
LineThe line to be deactivated. This must be exactly one of IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET.
StateIf zero, then wait for this line to be deactivated.
If not zero, then wait for this line to be activated.
Returns
The state of the IEC bus on return (like cbm_iec_poll).

If cbm_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 1448 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_iec_wait, and plugin_information_s::Plugin.

Referenced by vdd_iec_wait().

EXTERN int CBMAPIDECL cbm_listen ( CBM_FILE  HandleDevice,
unsigned char  DeviceAddress,
unsigned char  SecondaryAddress 
)

Send a LISTEN on the IEC serial bus.

This function sends a LISTEN on the IEC serial bus. This prepares a LISTENer, so that it will wait for our bytes we will write in the future.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
DeviceAddressThe address of the device on the IEC serial bus. This is known as primary address, too.
SecondaryAddressThe secondary address for the device on the IEC serial bus.
Returns
0 means success, else failure

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 945 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_listen, and plugin_information_s::Plugin.

Referenced by cbm_exec_command(), cbm_upload(), and vdd_listen().

EXTERN void CBMAPIDECL cbm_lock ( CBM_FILE  HandleDevice)

Lock the parallel port for the driver.

This function locks the driver onto the parallel port. This way, no other program or driver can allocate the parallel port and interfere with the communication.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.

If cbm_driver_open() did not succeed, it is illegal to call cbm_driver_close().

Remarks
A call to cbm_lock() is undone with a call to cbm_unlock().

Note that it is not necessary to call this function (or cbm_unlock()) when all communication is done with the handle to opencbm open (that is, between cbm_driver_open() and cbm_driver_close(). You only need this function to pin the driver to the port even when cbm_driver_close() is to be executed (for example, because the program terminates).

Definition at line 804 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE, opencbm_plugin_s::opencbm_plugin_lock, and plugin_information_s::Plugin.

Referenced by cbm_execute_devicecontrol().

EXTERN int CBMAPIDECL cbm_open ( CBM_FILE  HandleDevice,
unsigned char  DeviceAddress,
unsigned char  SecondaryAddress,
const void *  Filename,
size_t  FilenameLength 
)

Open a file on the IEC serial bus.

This function opens a file on the IEC serial bus.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
DeviceAddressThe address of the device on the IEC serial bus. This is known as primary address, too.
SecondaryAddressThe secondary address for the device on the IEC serial bus.
FilenameThe filename of the file to be opened
FilenameLengthThe size of the Filename. If zero, the Filename has to be a null-terminated string.
Returns
0 means success, else failure

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1012 of file cbm.c.

References cbm_raw_write(), cbm_unlisten(), DBG_PREFIX, DBG_WARN, FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_open, and plugin_information_s::Plugin.

Referenced by vdd_open().

EXTERN unsigned char CBMAPIDECL cbm_parallel_burst_read ( CBM_FILE  HandleDevice)

PARBURST: Read from the parallel port.

This function is a helper function for parallel burst: It reads from the parallel port.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
The value read from the parallel port

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 1635 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_UCHAR, opencbm_plugin_s::opencbm_plugin_parallel_burst_read, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_parallel_burst_read_track ( CBM_FILE  HandleDevice,
unsigned char *  Buffer,
unsigned int  Length 
)

PARBURST: Read a complete track.

This function is a helper function for parallel burst: It reads a complete track from the disk

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
BufferPointer to a buffer which will hold the bytes read.
LengthThe length of the Buffer.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function. If this function is not implemented, it will return -1.

Definition at line 1746 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_parallel_burst_read_track, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_parallel_burst_read_track_var ( CBM_FILE  HandleDevice,
unsigned char *  Buffer,
unsigned int  Length 
)

PARBURST: Read a variable length track.

This function is a helper function for parallel burst: It reads a variable length track from the disk

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
BufferPointer to a buffer which will hold the bytes read.
LengthThe length of the Buffer.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1780 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_parallel_burst_read_track, opencbm_plugin_s::opencbm_plugin_parallel_burst_read_track_var, and plugin_information_s::Plugin.

EXTERN void CBMAPIDECL cbm_parallel_burst_write ( CBM_FILE  HandleDevice,
unsigned char  Value 
)

PARBURST: Write to the parallel port.

This function is a helper function for parallel burst: It writes to the parallel port.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
ValueThe value to be written to the parallel port

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 1665 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE, opencbm_plugin_s::opencbm_plugin_parallel_burst_write, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_parallel_burst_write_track ( CBM_FILE  HandleDevice,
unsigned char *  Buffer,
unsigned int  Length 
)

PARBURST: Write a complete track.

This function is a helper function for parallel burst: It writes a complete track to the disk

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
BufferPointer to a buffer which hold the bytes to be written.
LengthThe length of the Buffer.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function. If this function is not implemented, it will return -1.

Definition at line 1817 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_parallel_burst_write_track, and plugin_information_s::Plugin.

EXTERN char* CBMAPIDECL cbm_petscii2ascii ( char *  Str)

Convert an null-termined PETSCII string to ASCII.

This function converts a string in PETSCII to ASCII.

Parameters
StrPointer to a buffer which holds a null-termined string in PETCII.
Returns
Returns a pointer to the Str itself, converted to ASCII.

If some character cannot be printer on the PC, they are replaced with a dot (".").

Definition at line 136 of file petscii.c.

References cbm_petscii2ascii_c().

EXTERN char CBMAPIDECL cbm_petscii2ascii_c ( char  Character)

Convert a PETSCII character to ASCII.

This function converts a character in PETSCII to ASCII.

Parameters
CharacterThe character value to be converted in PETSCII
Returns
Returns the value of character in ASCII if it can be displayed, a dot (".") otherwise.

Definition at line 64 of file petscii.c.

Referenced by cbm_petscii2ascii().

EXTERN unsigned char CBMAPIDECL cbm_pp_read ( CBM_FILE  HandleDevice)

Read a byte from a XP1541/XP1571 cable.

This function reads a single byte from the parallel portion of an XP1541/1571 cable.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
the byte which was received on the parallel port

This function reads the current state of the port. No handshaking is performed at all.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 1244 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_UCHAR, opencbm_plugin_s::opencbm_plugin_pp_read, and plugin_information_s::Plugin.

Referenced by cbm_identify_xp1541(), and vdd_pp_read().

EXTERN void CBMAPIDECL cbm_pp_write ( CBM_FILE  HandleDevice,
unsigned char  Byte 
)

Write a byte to a XP1541/XP1571 cable.

This function writes a single byte to the parallel portion of a XP1541/1571 cable.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Bytethe byte to be output on the parallel port

This function just writes on the port. No handshaking is performed at all.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 1282 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE, opencbm_plugin_s::opencbm_plugin_pp_write, and plugin_information_s::Plugin.

Referenced by vdd_pp_write().

EXTERN int CBMAPIDECL cbm_raw_read ( CBM_FILE  HandleDevice,
void *  Buffer,
size_t  Count 
)

Read data from the IEC serial bus.

This function retrieves data after a cbm_talk().

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
BufferPointer to a buffer which will hold the bytes read.
CountNumber of bytes to be read at most.
Returns
>= 0: The actual number of bytes read. <0 indicates an error.

At most Count bytes are read.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 906 of file cbm.c.

References DBG_MEMDUMP, FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_raw_read, and plugin_information_s::Plugin.

Referenced by cbm_device_status(), cbm_identify(), and vdd_raw_read().

EXTERN int CBMAPIDECL cbm_raw_write ( CBM_FILE  HandleDevice,
const void *  Buffer,
size_t  Count 
)

Write data to the IEC serial bus.

This function sends data after a cbm_listen().

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
BufferPointer to a buffer which hold the bytes to write to the bus.
CountNumber of bytes to be written.
Returns
>= 0: The actual number of bytes written. <0 indicates an error.

This function tries to write Count bytes. Anyway, if an error occurs, this function can stop prematurely.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 870 of file cbm.c.

References DBG_MEMDUMP, FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_raw_write, and plugin_information_s::Plugin.

Referenced by cbm_exec_command(), cbm_open(), cbm_upload(), and vdd_raw_write().

EXTERN int CBMAPIDECL cbm_reset ( CBM_FILE  HandleDevice)

RESET all devices.

This function performs a hardware RESET of all devices on the IEC serial bus.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
0 on success, else failure

Don't overuse this function! Normally, an initial RESET should be enough.

Control is returned after a delay which ensures that all devices are ready again.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1209 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_reset, and plugin_information_s::Plugin.

Referenced by vdd_reset().

EXTERN unsigned char CBMAPIDECL cbm_srq_burst_read ( CBM_FILE  HandleDevice)

PARBURST: Read from the parallel port.

This function is a helper function for parallel burst: It reads from the parallel port.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
The value read from the parallel port

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 1847 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_UCHAR, opencbm_plugin_s::opencbm_plugin_srq_burst_read, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_srq_burst_read_track ( CBM_FILE  HandleDevice,
unsigned char *  Buffer,
unsigned int  Length 
)

PARBURST: Read a complete track.

This function is a helper function for parallel burst: It reads a complete track from the disk

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
BufferPointer to a buffer which will hold the bytes read.
LengthThe length of the Buffer.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function. If this function is not implemented, it will return -1.

Definition at line 1958 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_srq_burst_read_track, and plugin_information_s::Plugin.

EXTERN void CBMAPIDECL cbm_srq_burst_write ( CBM_FILE  HandleDevice,
unsigned char  Value 
)

PARBURST: Write to the parallel port.

This function is a helper function for parallel burst: It writes to the parallel port.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
ValueThe value to be written to the parallel port

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 1877 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE, opencbm_plugin_s::opencbm_plugin_srq_burst_write, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_srq_burst_write_track ( CBM_FILE  HandleDevice,
unsigned char *  Buffer,
unsigned int  Length 
)

PARBURST: Write a complete track.

This function is a helper function for parallel burst: It writes a complete track to the disk

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
BufferPointer to a buffer which hold the bytes to be written.
LengthThe length of the Buffer.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function. If this function is not implemented, it will return -1.

Definition at line 1995 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_srq_burst_write_track, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_talk ( CBM_FILE  HandleDevice,
unsigned char  DeviceAddress,
unsigned char  SecondaryAddress 
)

Send a TALK on the IEC serial bus.

This function sends a TALK on the IEC serial bus. This prepares a TALKer, so that it will prepare to send us some bytes in the future.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
DeviceAddressThe address of the device on the IEC serial bus. This is known as primary address, too.
SecondaryAddressThe secondary address for the device on the IEC serial bus.
Returns
0 means success, else failure

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 976 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_talk, and plugin_information_s::Plugin.

Referenced by cbm_device_status(), cbm_identify(), and vdd_talk().

EXTERN int CBMAPIDECL cbm_tap_download_config ( CBM_FILE  HandleDevice,
unsigned char *  Buffer,
unsigned int  Buffer_Length,
int *  Status,
int *  BytesRead 
)

TAPE: Download configuration.

This function is a helper function for tape: It reads the active configuration.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
BufferPointer to a buffer which holds the bytes that are read.
Buffer_LengthThe length of the Buffer.
StatusThe return status.
BytesReadThe number of bytes read.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 2377 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_tap_download_config, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_tap_get_sense ( CBM_FILE  HandleDevice,
int *  Status 
)

TAPE: Get tape sense.

This function is a helper function for tape: It returns the current tape sense state.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
The tape sense state

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 2085 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_tap_get_sense, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_tap_get_ver ( CBM_FILE  HandleDevice,
int *  Status 
)

TAPE: Return tape firmware version.

This function is a helper function for tape: It returns the tape firmware version.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 2320 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_tap_get_ver, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_tap_motor_off ( CBM_FILE  HandleDevice,
int *  Status 
)

TAPE: Motor off.

This function is a helper function for tape: It turns the tape drive motor off.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 2205 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_tap_motor_off, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_tap_motor_on ( CBM_FILE  HandleDevice,
int *  Status 
)

TAPE: Motor on.

This function is a helper function for tape: It turns the tape drive motor on.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 2175 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_tap_motor_on, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_tap_prepare_capture ( CBM_FILE  HandleDevice,
int *  Status 
)

TAPE: Prepare capture.

This function is a helper function for tape: It prepares the ZoomFloppy hardware for tape capture.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 2025 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_tap_prepare_capture, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_tap_prepare_write ( CBM_FILE  HandleDevice,
int *  Status 
)

TAPE: Prepare write.

This function is a helper function for tape: It prepares the ZoomFloppy hardware for tape write.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 2055 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_tap_prepare_write, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_tap_start_capture ( CBM_FILE  HandleDevice,
unsigned char *  Buffer,
unsigned int  Buffer_Length,
int *  Status,
int *  BytesRead 
)

TAPE: Start capture.

This function is a helper function for tape: It starts the actual tape capture.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
BufferPointer to a buffer which holds the bytes that are read.
Buffer_LengthThe length of the Buffer.
StatusThe return status.
BytesReadThe number of bytes read.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 2247 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_tap_start_capture, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_tap_start_write ( CBM_FILE  HandleDevice,
unsigned char *  Buffer,
unsigned int  Length,
int *  Status,
int *  BytesWritten 
)

TAPE: Start write.

This function is a helper function for tape: It starts the actual tape write.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
BufferPointer to a buffer which holds the bytes to be written.
LengthThe number of bytes to write.
StatusThe return status.
BytesWrittenThe number of bytes written.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 2289 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_tap_start_write, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_tap_upload_config ( CBM_FILE  HandleDevice,
unsigned char *  Buffer,
unsigned int  Length,
int *  Status,
int *  BytesWritten 
)

TAPE: Upload configuration.

This function is a helper function for tape: It writes the active configuration.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
BufferPointer to a buffer which holds the bytes to be written.
LengthThe number of bytes to write.
StatusThe return status.
BytesWrittenThe number of bytes written.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 2419 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_tap_upload_config, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_tap_wait_for_play_sense ( CBM_FILE  HandleDevice,
int *  Status 
)

TAPE: Wait for <PLAY> sense.

This function is a helper function for tape: It waits until the user presses play on tape.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 2145 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_tap_wait_for_play_sense, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_tap_wait_for_stop_sense ( CBM_FILE  HandleDevice,
int *  Status 
)

TAPE: Wait for <STOP> sense.

This function is a helper function for tape: It waits until the user stops the tape.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
!= 0 on success.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Note that a plugin is not required to implement this function.

Definition at line 2115 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_tap_wait_for_stop_sense, and plugin_information_s::Plugin.

EXTERN int CBMAPIDECL cbm_unlisten ( CBM_FILE  HandleDevice)

Send an UNLISTEN on the IEC serial bus.

This function sends an UNLISTEN on the IEC serial bus. Other than LISTEN and TALK, an UNLISTEN is not directed to just one device, but to all devices on that IEC serial bus.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
0 on success, else failure

At least on a 1541 floppy drive, an UNLISTEN also undoes a previous TALK.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1100 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_unlisten, and plugin_information_s::Plugin.

Referenced by cbm_exec_command(), cbm_open(), cbm_upload(), and vdd_unlisten().

EXTERN void CBMAPIDECL cbm_unlock ( CBM_FILE  HandleDevice)

Unlock the parallel port for the driver.

This function unlocks the driver from the parallel port. This way, other programs and drivers can allocate the parallel port and do their own communication with whatever device they use.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.

If cbm_driver_open() did not succeed, it is illegal to call cbm_driver_close().

Remarks
Look at cbm_lock() for an explanation of this function.

Definition at line 832 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE, opencbm_plugin_s::opencbm_plugin_unlock, and plugin_information_s::Plugin.

Referenced by cbm_execute_devicecontrol().

EXTERN int CBMAPIDECL cbm_untalk ( CBM_FILE  HandleDevice)

Send an UNTALK on the IEC serial bus.

This function sends an UNTALK on the IEC serial bus. Other than LISTEN and TALK, an UNTALK is not directed to just one device, but to all devices on that IEC serial bus.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
Returns
0 on success, else failure

At least on a 1541 floppy drive, an UNTALK also undoes a previous LISTEN.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1128 of file cbm.c.

References FUNC_ENTER, FUNC_LEAVE_INT, opencbm_plugin_s::opencbm_plugin_untalk, and plugin_information_s::Plugin.

Referenced by cbm_device_status(), cbm_identify(), and vdd_untalk().

EXTERN int CBMAPIDECL cbm_upload ( CBM_FILE  HandleDevice,
unsigned char  DeviceAddress,
int  DriveMemAddress,
const void *  Program,
size_t  Size 
)

Upload a program into a floppy's drive memory.

This function writes a program into the drive's memory via use of "M-W" commands.

Parameters
HandleDeviceA CBM_FILE which contains the file handle of the driver.
DeviceAddressThe address of the device on the IEC serial bus. This is known as primary address, too.
DriveMemAddressThe address in the drive's memory where the program is to be stored.
ProgramPointer to a byte buffer which holds the program in the caller's address space.
SizeThe size of the program to be stored, in bytes.
Returns
Returns the number of bytes written into program memory. If it does not equal Size, than an error occurred. Specifically, -1 is returned on transfer errors.

If cbm_driver_open() did not succeed, it is illegal to call this function.

Definition at line 133 of file upload.c.

References cbm_listen(), cbm_raw_write(), cbm_unlisten(), DBG_ASSERT, FUNC_ENTER, and FUNC_LEAVE_INT.

Referenced by vdd_upload().

EXTERN int CBMAPIDECL gcr_4_to_5_encode ( const unsigned char *  source,
unsigned char *  dest,
size_t  sourceLength,
size_t  destLength 
)

Encode GCR data.

This function encodes a buffer of 4 plain bytes into a buffer of 5 GCR bytes

Parameters
sourceThe pointer to the source buffer of 4 read-only plain bytes
destThe pointer to the destination buffer of 5 GCR bytes
sourceLengthThe size of the source buffer, it should be greater or equal to 4. If the size given is less than or equal to 0 this is taken as assertion, since it denotes unwanted programming behaviour.
destLengthThe size of the destination buffer, it should be greater or equal to 5. If the size given is less than or equal to 0 this is taken as assertion, since it denotes unwanted programming behaviour.
Returns
0 means (partial) success, -1 means failure due to invalid buffer pointers or a sourceLength of less than or equal to 0.

Remarks:

The function in fact can be called with buffer lengths less than recommended, it then does partial conversions as long as there is input available or as long as output buffer bytes are allowed to be written.

The source and destination buffer pointers are allowed to overlap partially. As long as destination is less than or equal to source or as long as destination is bigger than source+3, it is allowed to let the buffers overlap. Other conditions are taken as assertions since conversion errors will occur (data taken as input gets overwritten before). This behaviour allows to construct in-place buffer conversions.

Definition at line 206 of file gcr_4b5b.c.

References DBG_ASSERT, DBG_PREFIX, DBG_WARN, FUNC_ENTER, and FUNC_LEAVE_INT.

EXTERN int CBMAPIDECL gcr_5_to_4_decode ( const unsigned char *  source,
unsigned char *  dest,
size_t  sourceLength,
size_t  destLength 
)

Decode GCR data.

This function decodes a buffer of 5 GCR bytes into a buffer of 4 plain bytes

Parameters
sourceThe pointer to the source buffer of 5 read-only GCR bytes
destThe pointer to the destination buffer of 4 plain bytes
sourceLengthThe size of the source buffer, it should be greater or equal to 5. If the size given is less than or equal to 0, this is taken as assertion, since it denotes unwanted programming behaviour.
destLengthThe size of the destination buffer, it should be greater or equal to 4. If the size given is less than or equal to 0 this is taken as assertion, since it denotes unwanted programming behaviour.
Returns
0 means (partial) success, -1 means failure due to invalid buffer pointers or a sourceLength of less than or equal to 0. Codes from 1 to 255 denote a bitmask of 8 bits with each representing an illegal GCR nybble code, when set to one.

Remarks:

The function in fact can be called with buffer lengths less than recommended, it then does partial conversions as long as there is input available or as long as output buffer bytes are allowed to be written.

The source and destination buffer pointers are allowed to overlap partially. As long as destination is less than source+2 or as long as destination is bigger than source+4, it is allowed to let the buffers overlap. Other conditions are taken as assertions since conversion errors will occur (data taken as input gets overwritten before). This behaviour allows to construct in-place buffer conversions.

Definition at line 81 of file gcr_4b5b.c.

References DBG_ASSERT, DBG_PREFIX, DBG_WARN, FUNC_ENTER, and FUNC_LEAVE_INT.