shuttle_usbat.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /* Driver for SCM Microsystems USB-ATAPI cable
  2. * Header File
  3. *
  4. * $Id: shuttle_usbat.h,v 1.5 2000/09/17 14:44:52 groovyjava Exp $
  5. *
  6. * Current development and maintenance by:
  7. * (c) 2000 Robert Baruch (autophile@dol.net)
  8. * (c) 2004, 2005 Daniel Drake <dsd@gentoo.org>
  9. *
  10. * See shuttle_usbat.c for more explanation
  11. *
  12. * This program is free software; you can redistribute it and/or modify it
  13. * under the terms of the GNU General Public License as published by the
  14. * Free Software Foundation; either version 2, or (at your option) any
  15. * later version.
  16. *
  17. * This program is distributed in the hope that it will be useful, but
  18. * WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License along
  23. * with this program; if not, write to the Free Software Foundation, Inc.,
  24. * 675 Mass Ave, Cambridge, MA 02139, USA.
  25. */
  26. #ifndef _USB_SHUTTLE_USBAT_H
  27. #define _USB_SHUTTLE_USBAT_H
  28. /* Supported device types */
  29. #define USBAT_DEV_HP8200 0x01
  30. #define USBAT_DEV_FLASH 0x02
  31. #define USBAT_EPP_PORT 0x10
  32. #define USBAT_EPP_REGISTER 0x30
  33. #define USBAT_ATA 0x40
  34. #define USBAT_ISA 0x50
  35. /* Commands (need to be logically OR'd with an access type */
  36. #define USBAT_CMD_READ_REG 0x00
  37. #define USBAT_CMD_WRITE_REG 0x01
  38. #define USBAT_CMD_READ_BLOCK 0x02
  39. #define USBAT_CMD_WRITE_BLOCK 0x03
  40. #define USBAT_CMD_COND_READ_BLOCK 0x04
  41. #define USBAT_CMD_COND_WRITE_BLOCK 0x05
  42. #define USBAT_CMD_WRITE_REGS 0x07
  43. /* Commands (these don't need an access type) */
  44. #define USBAT_CMD_EXEC_CMD 0x80
  45. #define USBAT_CMD_SET_FEAT 0x81
  46. #define USBAT_CMD_UIO 0x82
  47. /* Methods of accessing UIO register */
  48. #define USBAT_UIO_READ 1
  49. #define USBAT_UIO_WRITE 0
  50. /* Qualifier bits */
  51. #define USBAT_QUAL_FCQ 0x20 // full compare
  52. #define USBAT_QUAL_ALQ 0x10 // auto load subcount
  53. /* USBAT Flash Media status types */
  54. #define USBAT_FLASH_MEDIA_NONE 0
  55. #define USBAT_FLASH_MEDIA_CF 1
  56. /* USBAT Flash Media change types */
  57. #define USBAT_FLASH_MEDIA_SAME 0
  58. #define USBAT_FLASH_MEDIA_CHANGED 1
  59. /* USBAT ATA registers */
  60. #define USBAT_ATA_DATA 0x10 // read/write data (R/W)
  61. #define USBAT_ATA_FEATURES 0x11 // set features (W)
  62. #define USBAT_ATA_ERROR 0x11 // error (R)
  63. #define USBAT_ATA_SECCNT 0x12 // sector count (R/W)
  64. #define USBAT_ATA_SECNUM 0x13 // sector number (R/W)
  65. #define USBAT_ATA_LBA_ME 0x14 // cylinder low (R/W)
  66. #define USBAT_ATA_LBA_HI 0x15 // cylinder high (R/W)
  67. #define USBAT_ATA_DEVICE 0x16 // head/device selection (R/W)
  68. #define USBAT_ATA_STATUS 0x17 // device status (R)
  69. #define USBAT_ATA_CMD 0x17 // device command (W)
  70. #define USBAT_ATA_ALTSTATUS 0x0E // status (no clear IRQ) (R)
  71. /* USBAT User I/O Data registers */
  72. #define USBAT_UIO_EPAD 0x80 // Enable Peripheral Control Signals
  73. #define USBAT_UIO_CDT 0x40 // Card Detect (Read Only)
  74. // CDT = ACKD & !UI1 & !UI0
  75. #define USBAT_UIO_1 0x20 // I/O 1
  76. #define USBAT_UIO_0 0x10 // I/O 0
  77. #define USBAT_UIO_EPP_ATA 0x08 // 1=EPP mode, 0=ATA mode
  78. #define USBAT_UIO_UI1 0x04 // Input 1
  79. #define USBAT_UIO_UI0 0x02 // Input 0
  80. #define USBAT_UIO_INTR_ACK 0x01 // Interrupt (ATA & ISA)/Acknowledge (EPP)
  81. /* USBAT User I/O Enable registers */
  82. #define USBAT_UIO_DRVRST 0x80 // Reset Peripheral
  83. #define USBAT_UIO_ACKD 0x40 // Enable Card Detect
  84. #define USBAT_UIO_OE1 0x20 // I/O 1 set=output/clr=input
  85. // If ACKD=1, set OE1 to 1 also.
  86. #define USBAT_UIO_OE0 0x10 // I/O 0 set=output/clr=input
  87. #define USBAT_UIO_ADPRST 0x01 // Reset SCM chip
  88. /* USBAT Features */
  89. #define USBAT_FEAT_ETEN 0x80 // External trigger enable
  90. #define USBAT_FEAT_U1 0x08
  91. #define USBAT_FEAT_U0 0x04
  92. #define USBAT_FEAT_ET1 0x02
  93. #define USBAT_FEAT_ET2 0x01
  94. extern int usbat_transport(struct scsi_cmnd *srb, struct us_data *us);
  95. extern int init_usbat(struct us_data *us);
  96. struct usbat_info {
  97. int devicetype;
  98. /* Used for Flash readers only */
  99. unsigned long sectors; // total sector count
  100. unsigned long ssize; // sector size in bytes
  101. unsigned char sense_key;
  102. unsigned long sense_asc; // additional sense code
  103. unsigned long sense_ascq; // additional sense code qualifier
  104. };
  105. #endif