1 /* 2 * Copyright (C) 2000 Jens Axboe <axboe (at) suse.de> 3 * Copyright (C) 2001-2004 Peter Osterlund <petero2 (at) telia.com> 4 * 5 * May be copied or modified under the terms of the GNU General Public 6 * License. See linux/COPYING for more information. 7 * 8 * Packet writing layer for ATAPI and SCSI CD-R, CD-RW, DVD-R, and 9 * DVD-RW devices. 10 * 11 */ 12 #ifndef __PKTCDVD_H 13 #define __PKTCDVD_H 14 15 #include <linux/types.h> 16 17 /* 18 * 1 for normal debug messages, 2 is very verbose. 0 to turn it off. 19 */ 20 #define PACKET_DEBUG 1 21 22 #define MAX_WRITERS 8 23 24 #define PKT_RB_POOL_SIZE 512 25 26 /* 27 * How long we should hold a non-full packet before starting data gathering. 28 */ 29 #define PACKET_WAIT_TIME (HZ * 5 / 1000) 30 31 /* 32 * use drive write caching -- we need deferred error handling to be 33 * able to sucessfully recover with this option (drive will return good 34 * status as soon as the cdb is validated). 35 */ 36 #if defined(CONFIG_CDROM_PKTCDVD_WCACHE) 37 #define USE_WCACHING 1 38 #else 39 #define USE_WCACHING 0 40 #endif 41 42 /* 43 * No user-servicable parts beyond this point -> 44 */ 45 46 /* 47 * device types 48 */ 49 #define PACKET_CDR 1 50 #define PACKET_CDRW 2 51 #define PACKET_DVDR 3 52 #define PACKET_DVDRW 4 53 54 /* 55 * flags 56 */ 57 #define PACKET_WRITABLE 1 /* pd is writable */ 58 #define PACKET_NWA_VALID 2 /* next writable address valid */ 59 #define PACKET_LRA_VALID 3 /* last recorded address valid */ 60 #define PACKET_MERGE_SEGS 4 /* perform segment merging to keep */ 61 /* underlying cdrom device happy */ 62 63 /* 64 * Disc status -- from READ_DISC_INFO 65 */ 66 #define PACKET_DISC_EMPTY 0 67 #define PACKET_DISC_INCOMPLETE 1 68 #define PACKET_DISC_COMPLETE 2 69 #define PACKET_DISC_OTHER 3 70 71 /* 72 * write type, and corresponding data block type 73 */ 74 #define PACKET_MODE1 1 75 #define PACKET_MODE2 2 76 #define PACKET_BLOCK_MODE1 8 77 #define PACKET_BLOCK_MODE2 10 78 79 /* 80 * Last session/border status 81 */ 82 #define PACKET_SESSION_EMPTY 0 83 #define PACKET_SESSION_INCOMPLETE 1 84 #define PACKET_SESSION_RESERVED 2 85 #define PACKET_SESSION_COMPLETE 3 86 87 #define PACKET_MCN "4a656e734178626f65323030300000" 88 89 #undef PACKET_USE_LS 90 91 #define PKT_CTRL_CMD_SETUP 0 92 #define PKT_CTRL_CMD_TEARDOWN 1 93 #define PKT_CTRL_CMD_STATUS 2 94 95 struct pkt_ctrl_command { 96 __u32 command; /* in: Setup, teardown, status */ 97 __u32 dev_index; /* in/out: Device index */ 98 __u32 dev; /* in/out: Device nr for cdrw device */ 99 __u32 pkt_dev; /* in/out: Device nr for packet device */ 100 __u32 num_devices; /* out: Largest device index + 1 */ 101 __u32 padding; /* Not used */ 102 }; 103 104 /* 105 * packet ioctls 106 */ 107 #define PACKET_IOCTL_MAGIC ('X') 108 #define PACKET_CTRL_CMD _IOWR(PACKET_IOCTL_MAGIC, 1, struct pkt_ctrl_command) 109 110 111 #endif /* __PKTCDVD_H */ 112