1 /* $Id: tape.h,v 1.1 2003/08/05 03:39:33 fredette Exp $ */ 2 3 /* tme/generic/tape.h - header file for generic tape device support: */ 4 5 /* 6 * Copyright (c) 2003 Matt Fredette 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed by Matt Fredette. 20 * 4. The name of the author may not be used to endorse or promote products 21 * derived from this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 * POSSIBILITY OF SUCH DAMAGE. 34 */ 35 36 #ifndef _TME_GENERIC_TAPE_H 37 #define _TME_GENERIC_TAPE_H 38 39 #include <tme/common.h> 40 _TME_RCSID("$Id: tape.h,v 1.1 2003/08/05 03:39:33 fredette Exp $"); 41 42 /* includes: */ 43 #include <tme/element.h> 44 45 /* macros: */ 46 47 /* flags: */ 48 #define TME_TAPE_FLAG_FIXED TME_BIT(0) 49 #define TME_TAPE_FLAG_ILI TME_BIT(1) 50 #define TME_TAPE_FLAG_MARK TME_BIT(2) 51 #define TME_TAPE_FLAG_EOM TME_BIT(3) 52 53 /* controls: */ 54 #define TME_TAPE_CONTROL_LOAD (0) 55 #define TME_TAPE_CONTROL_UNLOAD (1) 56 #define TME_TAPE_CONTROL_DENSITY_GET (2) 57 #define TME_TAPE_CONTROL_DENSITY_SET (3) 58 #define TME_TAPE_CONTROL_BLOCK_SIZE_GET (4) 59 #define TME_TAPE_CONTROL_BLOCK_SIZE_SET (5) 60 #define TME_TAPE_CONTROL_MARK_WRITE (6) 61 #define TME_TAPE_CONTROL_MARK_SKIPF (7) 62 #define TME_TAPE_CONTROL_MARK_SKIPR (8) 63 #define TME_TAPE_CONTROL_REWIND (9) 64 65 /* types: */ 66 67 /* a tape control function: */ 68 struct tme_tape_control { 69 70 /* the private state: */ 71 void *tme_tape_control_private; 72 73 /* the control function: */ 74 int (*tme_tape_connection_control) _TME_P((void *, 75 unsigned int, ...)); 76 }; 77 78 /* a tape device connection: */ 79 struct tme_tape_connection { 80 81 /* the generic connection side: */ 82 struct tme_connection tme_tape_connection; 83 84 /* this is called to get a buffer for reading the device: */ 85 int (*tme_tape_connection_read) _TME_P((struct tme_tape_connection *, 86 int *, unsigned long *, 87 unsigned long *, 88 _tme_const tme_uint8_t **)); 89 90 /* this is called to get a buffer for writing the device: */ 91 int (*tme_tape_connection_write) _TME_P((struct tme_tape_connection *, 92 int, unsigned long, 93 unsigned long *, 94 tme_uint8_t **)); 95 96 /* this releases a buffer: */ 97 int (*tme_tape_connection_release) _TME_P((struct tme_tape_connection *, 98 int *, unsigned long *)); 99 100 /* a control function: */ 101 int (*tme_tape_connection_control) _TME_P((struct tme_tape_connection *, 102 unsigned int, ...)); 103 }; 104 105 /* prototypes: */ 106 int tme_tape_connection_score _TME_P((struct tme_connection *, unsigned int *)); 107 108 #endif /* !_TME_GENERIC_TAPE_H */ 109