scsi_scanner.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* $OpenBSD: scsi_scanner.h,v 1.10 2005/12/10 01:30:13 deraadt Exp $ */
  2. /*
  3. * Copyright (c) 1995 Kenneth Stailey. All rights reserved.
  4. * modified for configurable scanner support by Joachim Koenig
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. All advertising materials mentioning features or use of this software
  15. * must display the following acknowledgement:
  16. * This product includes software developed by Kenneth Stailey.
  17. * 4. The name of the author may not be used to endorse or promote products
  18. * derived from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  21. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  22. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  23. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  25. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  29. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. /*
  32. * SCSI scanner interface description
  33. */
  34. #ifndef _SCSI_SCANNER_H_
  35. #define _SCSI_SCANNER_H_
  36. /* SCSI scanner commands */
  37. #define GET_IMAGE_STATUS 0x0f
  38. #define WRITE_BIG 0x2a
  39. #define OBJECT_POSITION 0x31
  40. /* generic scanner command formats */
  41. struct scsi_r_scanner {
  42. #define READ_BIG 0x28
  43. u_int8_t opcode;
  44. u_int lun:3;
  45. u_int res1:5;
  46. u_int8_t code;
  47. u_int8_t res2;
  48. u_int8_t qualifier;
  49. u_int8_t len[3];
  50. u_int8_t control;
  51. };
  52. struct scsi_get_buffer_status {
  53. #define GET_BUFFER_STATUS 0x34
  54. u_int8_t opcode;
  55. u_int lun:3;
  56. u_int res1:4;
  57. u_int wait:1;
  58. u_int8_t res2[5];
  59. u_int8_t len[2];
  60. u_int8_t control;
  61. };
  62. struct scsi_rw_scanner {
  63. #define READ 0x08
  64. #define WRITE 0x0a
  65. u_int8_t opcode;
  66. u_int8_t byte2;
  67. #define SRW_FIXED 0x01
  68. u_int8_t len[3];
  69. u_int8_t control;
  70. };
  71. struct scsi_start_stop {
  72. #define START_STOP 0x1b
  73. u_int8_t opcode;
  74. u_int8_t byte2;
  75. u_int8_t unused[2];
  76. u_int8_t how;
  77. #define SSS_STOP 0x00
  78. #define SSS_START 0x01
  79. #define SSS_LOEJ 0x02
  80. u_int8_t control;
  81. };
  82. struct scsi_set_window {
  83. #define SET_WINDOW 0x24 /* set params of image area and windows */
  84. #define GET_WINDOW 0x25
  85. u_int8_t opcode;
  86. u_int8_t byte2;
  87. u_int8_t reserved[4];
  88. u_int8_t len[3];
  89. u_int8_t control;
  90. };
  91. struct scsi_window_data {
  92. u_int8_t reserved[6]; /* window header */
  93. u_int8_t window_desc_len[2]; /* ditto */
  94. u_int8_t window_id; /* must be zero */
  95. u_int res1:7;
  96. u_int auto_bit:1;
  97. u_int8_t x_res[2];
  98. u_int8_t y_res[2];
  99. u_int8_t x_org[4];
  100. u_int8_t y_org[4];
  101. u_int8_t width[4];
  102. u_int8_t length[4];
  103. u_int8_t brightness;
  104. u_int8_t threshold;
  105. u_int8_t contrast;
  106. u_int8_t image_comp; /* image composition (data type) */
  107. u_int8_t bits_per_pixel;
  108. u_int8_t halftone_pattern[2];
  109. u_int rif:1; /* reverse image format (mono negative) */
  110. u_int res2:4;
  111. u_int pad_type:3;
  112. u_int8_t bit_ordering[2];
  113. u_int8_t compression_type;
  114. u_int8_t compression_arg;
  115. u_int8_t res3[6];
  116. };
  117. /* mustek scsi commands */
  118. #define MUSTEK_SET_WINDOW 0x04 /* set image area and windows */
  119. #define MUSTEK_ADF 0x10 /* ADF and backtracking selection */
  120. #define MUSTEK_LUT 0x55 /* look up table download */
  121. #endif /* _SCSI_SCANNER_H_ */