pktcdvd.h 2.6 KB

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