/catweasel-cw

Set of "cw" tools (user space and kernel driver) for accessing media with a Catweasel floppy controller

Primary LanguageCGNU General Public License v2.0GPL-2.0

Author:   Karsten Scheibler
Homepage: http://unusedino.de/cw/
eMail:    cw@unusedino.de


  =======================
  [1] GENERAL INFORMATION
  =======================


cw is (yet another) package for the Catweasel controller, look under [5] for
other existing packages. This package is especially for accessing the floppy
drives connected to Catweasel. Currently the following cards are supported:
  * MK2 (connected to an IDE controller)
  * MK3 (PCI card)
  * MK4 (PCI card)
  * MK4plus (PCI card)

cw consists of a kernel driver and a companion user space program (cwtool).
The kernel driver should work with Linux 2.4.x, 2.6.x and 3.x. Look at the
homepage of the manufacturer http://www.jschoenfeld.com/ for more details
about the controller features. Please read also the man page for some
hardware oddities you should know about, before complaining that something
does not work as expected.


  ============================
  [2] SHORT BUILD INSTRUCTIONS
  ============================


To build cw a simple 'make' should be enough. Remember that you need the
source of your running kernel in order to compile the driver module. cw was
tested on x86 under different distributions with different Linux kernel
versions (to name a few: 2.4.26, 2.4.32, 2.6.11.2 and 2.6.14.2 all directly
taken from http://www.kernel.org/), it also succesfully compiled on
Knoppix 4.0.2, SuSE 10.0 - 10.3, 11.1, 11.2, Ubuntu 10.10 (x86_64), Debian 6.0
and Ubuntu 13.04 (x86_64). There were also reports, that cw runs on PowerPC
platforms under Linux without problems.

In case you use another Unix-like operating system like *BSD, you may still
compile cwtool stand-alone. If 'uname' does not return Linux, the compilation
of the driver will be disabled automatically. If you use OSX, please look
also under [4] for further instructions. With the help of Cygwin you may
also compile cwtool under Windows.

You may build cwtool with dietlibc, just set and export the environment
variable DIET to the location of your 'diet' binary and run 'make'. Dietlibc
is a libc that is optimized for small size, look at
http://www.fefe.de/dietlibc/ for more.


  ===================================
  [3] SHORT INSTALLATION INSTRUCTIONS
  ===================================


NOTE: The file conf/cwtoolrc.default contains the configuration for all
      currently supported disk formats. This file is also compiled into
      cwtool (comments are stripped away, you may see the contents with
      'cwtool -D'). You may also place a customized version of this file
      to /etc/cwtoolrc or $HOME/.cwtoolrc, so cwtool will load it on every
      start up. But currently there is no description how such a file has
      to look like, because the syntax may change in future versions. For
      easy changes such as a different number of sectors per track you
      should use conf/cwtoolrc.default as a template. But be prepared that
      you may have to do your changes again with new versions of cwtool.

NOTE: If you use devfs you have to determine yourself how to add the device
      nodes permanently. I do not plan to add support for it, because
      devfs is obsolete and removed in current versions of the kernel.
      Starting with cw-0.11 basic support for udev was introduced, so a
      'make install' should add the needed things. But as every distribution
      handles udev a little bit different it may not work on your
      installation (see also step 2b below)

NOTE: You need to be root to do the things described below.

You may use cw without calling 'make install' if you do the following steps
manually:

1a) load the module
    # insmod module/cw.o			(Linux 2.4)
    # insmod module/cw.ko			(Linux 2.6+)

    For MK2 cards you need to load the module with an additional parameter:

    # insmod module/cw.o cw_mk2_ports=0x1f0	(Linux 2.4, MK2 on primary
    						 IDE)
    # insmod module/cw.ko cw_mk2_ports=0x170	(Linux 2.6+, MK2 on secondary
    						 IDE)

    For the MK3/MK4/MK4plus cards make sure to unload the netjet ISDN kernel
    module beforehand otherwise it is possible that no catweasel controller
    will be found. The netjet module seems to look for the same PCI-IDs as
    the cw module.

1b) make sure the module was loaded correctly
    # lsmod
    # dmesg | tail
    The first command prints out a list of all loaded kernel modules, the
    second prints out kernel messages, the last lines should contain
    messages from cw.

2a) create the device nodes (up to 4 controllers are supported, every
    controller may have up to 2 floppy drives). Here it is assumed you use
    the default char major number 120.
    # mknod /dev/cw0raw0 c 120 31
    # mknod /dev/cw0raw1 c 120 63
    # mknod /dev/cw1raw0 c 120 95
    # mknod /dev/cw1raw1 c 120 127
    # mknod /dev/cw2raw0 c 120 159
    # mknod /dev/cw2raw1 c 120 191
    # mknod /dev/cw3raw0 c 120 223
    # mknod /dev/cw3raw1 c 120 255

2b) If you use udev, add according entries to /etc/udev/static_devices.txt
    or create device nodes manually in /lib/udev/devices or do whatever your
    distribution needs to be done to make the device nodes permanent,
    otherwise they will disappear with the next reboot. If you have no luck
    with udev, just create a startscript with the above mknod lines and
    execute it after udev was started.

3a) run cwtool to read a disk (in this case: read an Amiga 3.5" DD disk
    from the first drive on the first controller and write it to image.adf)
    # bin/cwtool -R -v amiga_dd /dev/cw0raw0 image.adf

3b) Writing a disk is similar (in this case: write image.d64 to a C1541
    5.25" disk in the second drive of the first controller)
    # bin/cwtool -W -v c1541 image.d64 /dev/cw0raw1

3c) Look at the man page of cwtool, to get an overview what other things
    are possible
    # man doc/cwtool.1

If you use 'make install' to install cw then /etc/modules.conf (Linux 2.4),
/etc/modprobe.conf or /etc/modprobe.d (Linux 2.6+) will be modified to allow
automatic module loading. Per default char major number 120 is used. If this
major number is already in use (look at /proc/devices) you need to choose a
different number. Use the command 'make install MAJOR=xx', where xx is a free
char major number on your system. The following parameters are also possible,
if these parameters are not specified more or less useful default values are
used.

BIN_DIR             - directory in which cwtool is installed
MAN_DIR             - the man page will be copied to $MAN_DIR/man1
MK2_PORTS           - the port(s) of the MK2 card(s) (0x1f0 for primary IDE,
                      0x170 for secondary IDE)
MODULE_DIR          - directory in which the kernel driver module is
                      installed
MODULE_NAME         - the name of the module (you need to choose a different
                      name than 'cw' if you also use the catweasel package
		      listed in [6])
MODULES_CONF        - full path of the modules.conf or modprobe.conf file
                      or alternatively the modprobe.d directory if no
		      modprobe.conf exists
UDEV_STATIC_DEVICES - this file contains static entries for device nodes,
                      if it exists entries suitable for cw are added
		      (seems only to exist on SuSE 10.0)

NOTE: For MK2 cards, you will need a special 40-pin IDE cable that has pins
      37 and 38 (IDE_CS0 and IDE_CS1) swapped. You have to specify the
      MK2_PORTS parameter otherwise no such card will be found. In addition,
      make sure that other drivers do not use these ports.

NOTE: You may use 'make upgrade' if you want to upgrade from an older
      version of cw, but you need to specify those parameters that differ
      from the default values. Upgrading just means overwriting cwtool, the
      kernel module and the man page with the current versions and creating
      device nodes if necessary. Be aware that this has not been extensively
      tested. If possible uninstall your old version of cw and install the
      new one.

NOTE: You may use 'make uninstall' to uninstall cw, the parameters of
      the last 'make install' call are saved and are used for uninstalling,
      but after a 'make clean' these saved parameters will be lost.


  =================
  [4] CONTRIBUTIONS
  =================


1) In the contrib directory you will find a simple GUI for cwtool written by
   David Bentham (aka PegXlin DEV). If you want to use it, consult the
   according README in contrib/cwtoolgui. If you have enhancements for this
   GUI or other useful additions, please contact me under the mail address
   listed at the start of this README.

2) If you want to use the kernel driver of cw for your own programs please
   have a look at the src/cwio directory.

3) Compiling on OSX is possible. Normally cwtool will be build stand-alone.
   To build cwtool with support for the catweasel-osx driver, use
   # make CATWEASEL_OSX=1
   If needed adapt the paths in Makefile.conf beforehand. The driver model
   is of course completely different than the Linux standard. The
   Sourceforge project catweasel-osx (http://catweasel-osx.sourceforge.net)
   creates a companion PCI Catweasel driver that cwtool will connect to. If
   you check out catweasel-osx and cw projects as peers in your file system,
   you can first build and install catweasel-osx and then build cwtool which
   will connect to it. cwtool can use up to two PCI Catweasel MK3 or MK4
   cards, with up to two drives connected to each. The device driver "names"
   are Cat0d0/Cat0d1 for the first Catweasel card and first and second
   drives, respectively; and Cat1d0/Cat1d1 for the second Catweasel and its
   first and second drives.


  ====================
  [5] RELATED PROJECTS
  ====================


There are at least 6 other Linux drivers for the Catweasel controller:

catweasel (*) - http://llg.cubic.org/cw/
	Written by Dirk Jagdmann. A Linux driver for SID, Joysticks and Amiga
	keyboard. If you also want to use this package together with cw,
	remember to set MODULE_NAME to a different name, because catweasel
	uses the same name for the driver module (see the installation
	instructions in [3]).

cwfloppy (*) - http://www.soundtracker.org/raw/cwfloppy/
	Written by Michael Krause. A Linux driver for accessing the floppies
	on a Catweasel controller. This driver exports block devices, so you
	are able to mount Amiga disks under Linux. Currently it supports
	Amiga and MSDOS disks (and C1541 with a patch written by me). To
	support more formats i found it more useful to use another method to
	export data to user space, thats why i started my own driver. Instead
	of a block device cw uses a char device and passes the raw Catweasel
	data to the calling program, so all format routines do not reside in
	the kernel driver anymore.

hardsid (*) - http://hardsid.sourceforge.net/
	Written by Jarno Paananen and Simon White. A Linux driver for the
	Hardsidcards and the SID-Chips on Catweasel MK3 and MK4.

hardsid-catweasel (*) - http://www.bel.fi/~alankila/blog/2005/12/30/HardSID-Catweasel%200.01.html
	Written by Antti Lankila. This driver only contains support for
	Catweasel MK4 cards and is a rework of the hardsid driver.

cw2dmk - http://www.tim-mann.org/catweasel.html
	Written by Tim Mann. A Linux driver (other platforms are also
	supported) for accessing the floppies on a Catweasel Controller,
	especially TRS80 related formats are supported. This package does
	not use a kernel driver to access the Catweasel controller, but you
	should avoid using this program when a kernel driver from another
	package is loaded.

hardsec_cw - http://webpages.charter.net/thecomputercollection/hardsec_cw.tar.gz
	Adapted version of cw2dmk by Jay Jaeger based on some work by
	Jim Battle, especially for hard sectored disks.

(*) Currently you may load only one kernel module accessing the
    Catweasel controller at the same time.


  =====================
  [6] KNOWN FORKS OF CW
  =====================


https://github.com/ezrec/cw/
	A patched version of cw-0.13 with support for MK2 cards. Current
	versions of cw have built-in support for such cards.

https://github.com/glaubitz/cw/
	A patched version of cw-0.13 with compile time fixes for 2.6.38
	kernels. Current versions of cw include those fixes.

https://github.com/balr0g/cw/
	A patched version of cw-0.13 with additional disk formats and
	compile time fixes for cwtool for Mac OS X. Current versions of
	cw include this.

http://sourceforge.net/projects/catweasel-osx/files/cwtools-diffs/
	A patched version of cw-0.13 with support for OSX. Current versions
	of cw include this.