home *** CD-ROM | disk | FTP | other *** search
GNU Info File | 1996-09-20 | 8.5 KB | 267 lines |
- This is Info file libscsi.info, produced by Makeinfo-1.55 from the
- input file libscsi.texi.
-
- START-INFO-DIR-ENTRY
- * libscsi: (libscsi). A library for direct scsi device access.
- END-INFO-DIR-ENTRY
-
- This file documents libscsi 0.2
-
- Copyright 1996 Dieter Baron and Armin Obersteiner
-
- Permission is granted to make and distribute verbatim copies of this
- manual provided the copyright notice and this permission notice are
- preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
- this manual under the conditions for verbatim copying, provided that the
- entire resulting derived work is distributed under the terms of a
- permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
- manual into another language, under the above conditions for modified
- versions, except that this permission notice may be stated in a
- translation approved by the Free Software Foundation.
-
- File: libscsi.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir)
-
- libscsi
- *******
-
- This file documents libscsi, a library for direct SCSI device access.
- This edition documents version 0.2.
-
- It is an early draft version; large parts are still missing - we
- didn't want to delay the release, however.
-
- * Menu:
-
- * Introduction:: Design Philosophy of libscsi
- * Low Level:: Low Level Functions
- * Extending:: Extending libscsi
- * Porting:: Porting libscsi to other platforms
- * Interfaces:: Notes on the Interfaces
-
- * Index::
- * Index of Functions::
- * Index of Variables and Types::
-
- File: libscsi.info, Node: Introduction, Next: Low Level, Prev: Top, Up: Top
-
- Introduction
- ************
-
- Some applications (such as cd players and cd writers) need direct
- access to SCSI devices. Although most operating system provide such
- services, each does so in a different way; writing portable software is
- painfull.
-
- One goal of libscsi is to encapsulate these system dependencies and
- to provide a uniform interface to the application. *Note Low Level
- Functions: Low Level.
-
- The other is to provide convenience functions for SCSI commands, to
- avoid programming errors and to render programs more readable. These
- are grouped according to the sections of X3.131 (the ANSI standard for
- SCSI II) or devices for vendor specific commands.
-
- File: libscsi.info, Node: Low Level, Next: Extending, Prev: Introduction, Up: Top
-
- Low Level Functions
- *******************
-
- - Function: SCSI * sc_open (char *DEVICE)
-
- - Function: int sc_close (SCSI *SDEV)
- `sc_close' closes device SDEV, deallocating all resources
- associated with it. SDEV must not be passed to any libscsi
- function afterwards.
-
- - Function: int sc_send (SCSI *SDEV, int DIRECTION, int CMDLEN, char
- *CMD, int DATALEN, char *DATA)
- The `sc_send' function sends a command to device SDEV.
-
- CMD is the command descriptor block (CDB) of the command, CMDLEN
- its length (in bytes).
-
- Set DIRECTION to `SC_READ' if data will be transferred from the
- device to the host in the data in phase; to `SC_WRITE' if data
- will be transferred to the device during data out phase; or to 0
- if no data (besides the CDB) will be transferred.
-
- If this is a write command (`SC_WRITE'), DATA points to DATALEN
- bytes to be transferred. If it is a read command (`SC_READ'), up
- to DATALEN bytes will be placed in DATA.
-
- On success, `sc_send' return 0 for write and transferless commands
- and the number of bytes read on read commands. On error, -1 is
- returend and the error indicator and sense data in SDEV are set.
-
- - Function: int sc_set_timeout (SCSI *SDEV, u_long TIMEOUT)
- On systems that timeout commands, `sc_set_timeout' is used to
- specify a timeout of TIMEOUT milliseconds for command completion
- on device SDEV.
-
- If the timeout cannot be set as specified, -1 is returned.
- However, if the system does not timeout commands, this function is
- a noop, and 0 is returned.
-
- If the underlying system supports only one global timeout value
- for all devices, it is expected of the interface functions to set
- it appropriatly for each device before sending a command.
-
- File: libscsi.info, Node: Extending, Next: Porting, Prev: Low Level, Up: Top
-
- Extending libscsi
- *****************
-
- You have to create the files 'lib/xx_????.c' and 'scsi/xx.h' (or just
- add prototypes to it).
-
- xx - command type OR device type OR product
- ???? - command name
-
- If you've included more commands or support for other devices please
- contact us for inclusion in our distribution.
-
- File: libscsi.info, Node: Porting, Next: Interfaces, Prev: Extending, Up: Top
-
- Porting libscsi to other platforms
- **********************************
-
- To port libscsi to a new platform, you have to provide definitions
- for the `SCSI' structure and the low level functions `sc_open',
- `sc_close', `sc_send', and `sc_set_timeout'. They should behave as
- documented in *Note Low Level Functions: Low Level. Look at the
- provided interfaces (`scsi/os_{netbsd,amiga}.h' and
- `lib/os_{netbsd,amiga}.c') for examples.
-
- Remove the symbolic links `scsi/os.h' and `lib/os.c', and place your
- header and soruce files there.
-
- If you want to make your interface part of the distribution, pick a
- name and place it in the files `scsi/os_NAME.h' and `lib/os_NAME.c'.
- Also, edit `configure.in' to recognize systems supporting your
- interface.
-
- Also, send us your new interface, so we can include it in future
- releases.
-
- File: libscsi.info, Node: Interfaces, Next: Index, Prev: Porting, Up: Top
-
- Notes on the Interfaces
- ***********************
-
- This section contains interface specific notes, such as the syntax
- and semantics of device names or constraints.
-
- * Menu:
-
- * AmigaDOS::
- * NetBSD::
-
- File: libscsi.info, Node: AmigaDOS, Next: NetBSD, Up: Interfaces
-
- AmigaDOS
- ========
-
- - compiling and developing
- You simply need the `gcc' or ADE environment installed.
-
- - device names
- SCSI devices are used in following notation
- DEVICE:UNIT
- For example, `gvpscsi.device:2', or simplified, `gvpscsi:2'.
- Also, `gvpscsi' is equivalent to `gvpscsi.device:0' and
- `gvpscsi:0'.
-
- - platform information
- Any Amiga with Kickstart 2.04+ and SCSI controller will do. (With
- a few changes Kickstart 1.3 would work too.)
-
- Developed and tested with: A2000 (total 7MB), A2630 (2MB), GVP
- Series II, some SCSI devices: hd, cd, zip.
-
- File: libscsi.info, Node: NetBSD, Prev: AmigaDOS, Up: Interfaces
-
- NetBSD
- ======
-
- - operating system release
- The ioctl `SCIOCCOMMAND' is unimplemented in versions 1.0 and
- earlier, and will always fail. Thus, libscsi only works with newer
- version, starting with 1.0A.
-
- - device names
- Under NetBSD, SCSI device names are file names for character
- special devices, usually partition `d'. (So, for `sd0', the
- zeroth SCSI hard disk, the name would be `/dev/rsd0d'.) As a
- shorthand, one can specify the device (e.g. `sd0'), rather than the
- file name.
-
- - opening a device
- Since a character special device file is opened (from which reads
- are possible), NetBSD ensures that a medium is present and the
- device is ready. For a direct SCSI interface, however, this may
- prove disadvantageous.
-
- File: libscsi.info, Node: Index, Next: Index of Functions, Prev: Interfaces, Up: Top
-
- Index
- *****
-
- * Menu:
-
- * AmigaDOS: AmigaDOS.
- * extending: Extending.
- * interfaces: Interfaces.
- * introduction: Introduction.
- * NetBSD: NetBSD.
- * porting: Porting.
-
- File: libscsi.info, Node: Index of Functions, Next: Index of Variables and Types, Prev: Index, Up: Top
-
- Index of Functions
- ******************
-
- * Menu:
-
- * sc_close: Low Level.
- * sc_open: Low Level.
- * sc_send: Low Level.
- * sc_set_timeout: Low Level.
-
- File: libscsi.info, Node: Index of Variables and Types, Prev: Index of Functions, Up: Top
-
- Index of Variables and Types
- ****************************
-
- * Menu:
-
- Tag Table:
- Node: Top973
- Node: Introduction1609
- Node: Low Level2365
- Node: Extending4259
- Node: Porting4701
- Node: Interfaces5616
- Node: AmigaDOS5897
- Node: NetBSD6580
- Node: Index7438
- Node: Index of Functions7857
- Node: Index of Variables and Types8220
- End Tag Table
-