root/include/linux/optcd.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 
   2 /* Defines for the Optics Storage 8000AT CDROM drive. */
   3 
   4 #ifndef _LINUX_OPTCD_H
   5 
   6 #define _LINUX_OPTCD_H
   7 
   8 /* Drive registers */
   9 #define OPTCD_PORTBASE  0x340
  10 /* Read */
  11 #define DATA_PORT       optcd_port      /* Read data/status */
  12 #define STATUS_PORT     optcd_port+1    /* Indicate data/status availability */
  13 /* Write */
  14 #define COMIN_PORT      optcd_port      /* For passing command/parameter */
  15 #define RESET_PORT      optcd_port+1    /* Write anything and wait 0.5 sec */
  16 #define HCON_PORT       optcd_port+2    /* Host Xfer Configuration */
  17 
  18 
  19 /* Command completion/status read from DATA register */
  20 #define ST_DRVERR               0x80
  21 #define ST_DOOR_OPEN            0x40
  22 #define ST_MIXEDMODE_DISK       0x20
  23 #define ST_MODE_BITS            0x1c
  24 #define ST_M_STOP               0x00
  25 #define ST_M_READ               0x04
  26 #define ST_M_AUDIO              0x04
  27 #define ST_M_PAUSE              0x08
  28 #define ST_M_INITIAL            0x0c
  29 #define ST_M_ERROR              0x10
  30 #define ST_M_OTHERS             0x14
  31 #define ST_MODE2TRACK           0x02
  32 #define ST_DSK_CHG              0x01
  33 #define ST_L_LOCK               0x01
  34 #define ST_CMD_OK               0x00
  35 #define ST_OP_OK                0x01
  36 #define ST_PA_OK                0x02
  37 #define ST_OP_ERROR             0x05
  38 #define ST_PA_ERROR             0x06
  39 
  40 /* Error codes (appear as command completion code from DATA register) */
  41 /* Player related errors */
  42 #define ERR_ILLCMD      0x11    /* Illegal command to player module */
  43 #define ERR_ILLPARM     0x12    /* Illegal parameter to player module */
  44 #define ERR_SLEDGE      0x13
  45 #define ERR_FOCUS       0x14
  46 #define ERR_MOTOR       0x15
  47 #define ERR_RADIAL      0x16
  48 #define ERR_PLL         0x17    /* PLL lock error */
  49 #define ERR_SUB_TIM     0x18    /* Subcode timeout error */
  50 #define ERR_SUB_NF      0x19    /* Subcode not found error */
  51 #define ERR_TRAY        0x1a
  52 #define ERR_TOC         0x1b    /* Table of Contents read error */
  53 #define ERR_JUMP        0x1c
  54 /* Data errors */
  55 #define ERR_MODE        0x21
  56 #define ERR_FORM        0x22
  57 #define ERR_HEADADDR    0x23    /* Header Address not found */
  58 #define ERR_CRC         0x24
  59 #define ERR_ECC         0x25    /* Uncorrectable ECC error */
  60 #define ERR_CRC_UNC     0x26    /* CRC error and uncorrectable error */
  61 #define ERR_ILLBSYNC    0x27    /* Illegal block sync error */
  62 #define ERR_VDST        0x28    /* VDST not found */
  63 /* Timeout errors */
  64 #define ERR_READ_TIM    0x31    /* Read timeout error */
  65 #define ERR_DEC_STP     0x32    /* Decoder stopped */
  66 #define ERR_DEC_TIM     0x33    /* Decoder interrupt timeout error */
  67 /* Function abort codes */
  68 #define ERR_KEY         0x41    /* Key -Detected abort */
  69 #define ERR_READ_FINISH 0x42    /* Read Finish */
  70 /* Second Byte diagnostic codes */
  71 #define ERR_NOBSYNC     0x01    /* No block sync */
  72 #define ERR_SHORTB      0x02    /* Short block */
  73 #define ERR_LONGB       0x03    /* Long block */
  74 #define ERR_SHORTDSP    0x04    /* Short DSP word */
  75 #define ERR_LONGDSP     0x05    /* Long DSP word */
  76 
  77 
  78 /* Status availability flags read from STATUS register */
  79 #define FL_EJECT        0x20
  80 #define FL_WAIT         0x10    /* active low */
  81 #define FL_EOP          0x08    /* active low */
  82 #define FL_STEN         0x04    /* Status available when low */
  83 #define FL_DTEN         0x02    /* Data available when low */
  84 #define FL_DRQ          0x01    /* active low */
  85 #define FL_RESET        0xde    /* These bits are high after a reset */
  86 #define FL_STDT         (FL_STEN|FL_DTEN)
  87 
  88 
  89 /* Transfer mode, written to HCON register */
  90 #define HCON_DTS        0x08
  91 #define HCON_SDRQB      0x04
  92 #define HCON_LOHI       0x02
  93 #define HCON_DMA16      0x01
  94 
  95 
  96 /* Drive command set, written to COMIN register */
  97 /* Quick response commands */
  98 #define COMDRVST        0x20    /* Drive Status Read */
  99 #define COMERRST        0x21    /* Error Status Read */
 100 #define COMIOCTLISTAT   0x22    /* Status Read; reset disk changed bit */
 101 #define COMINITSINGLE   0x28    /* Initialize Single Speed */
 102 #define COMINITDOUBLE   0x29    /* Initialize Double Speed */
 103 #define COMUNLOCK       0x30    /* Unlock */
 104 #define COMLOCK         0x31    /* Lock */
 105 #define COMLOCKST       0x32    /* Lock/Unlock Status */
 106 #define COMVERSION      0x40    /* Get Firmware Revision */
 107 #define COMVOIDREADMODE 0x50    /* Void Data Read Mode */
 108 /* Read commands */
 109 #define COMFETCH        0x60    /* Prefetch Data */
 110 #define COMREAD         0x61    /* Read */
 111 #define COMREADRAW      0x62    /* Read Raw Data */
 112 #define COMREADALL      0x63    /* Read All 2646 Bytes */
 113 /* Player control commands */
 114 #define COMLEADIN       0x70    /* Seek To Lead-in */
 115 #define COMSEEK         0x71    /* Seek */
 116 #define COMPAUSEON      0x80    /* Pause On */
 117 #define COMPAUSEOFF     0x81    /* Pause Off */
 118 #define COMSTOP         0x82    /* Stop */
 119 #define COMOPEN         0x90    /* Open Tray Door */
 120 #define COMCLOSE        0x91    /* Close Tray Door */
 121 #define COMPLAY         0xa0    /* Audio Play */
 122 #define COMPLAY_TNO     0xa2    /* Audio Play By Track Number */
 123 #define COMSUBQ         0xb0    /* Read Sub-q Code */
 124 #define COMLOCATION     0xb1    /* Read Head Position */
 125 /* Audio control commands */
 126 #define COMCHCTRL       0xc0    /* Audio Channel Control */
 127 /* Miscellaneous (test) commands */
 128 #define COMDRVTEST      0xd0    /* Write Test Bytes */
 129 #define COMTEST         0xd1    /* Diagnostic Test */
 130 
 131 
 132 #define BUSY_TIMEOUT            10000000        /* for busy wait */
 133 #define SLEEP_TIMEOUT           400             /* for timer wait */
 134 #define READ_TIMEOUT            3000            /* for poll wait */
 135 #define RESET_WAIT              1000
 136 
 137 #define SET_TIMER(func, jifs) \
 138         delay_timer.expires = jifs; \
 139         delay_timer.function = (void *) func; \
 140         add_timer(&delay_timer);
 141 #define CLEAR_TIMER             del_timer(&delay_timer)
 142 
 143 #define MAX_TRACKS              104
 144 
 145 struct msf {
 146         unsigned char   min;
 147         unsigned char   sec;
 148         unsigned char   frame;
 149 };
 150 
 151 struct opt_Play_msf {
 152         struct msf      start;
 153         struct msf      end;
 154 };
 155 
 156 struct opt_DiskInfo {
 157         unsigned char   first;
 158         unsigned char   last;
 159         struct msf      diskLength;
 160         struct msf      firstTrack;
 161 };
 162 
 163 struct opt_Toc {
 164         unsigned char   ctrl_addr;
 165         unsigned char   track;
 166         unsigned char   pointIndex;
 167         struct msf      trackTime;
 168         struct msf      diskTime;
 169 };
 170 
 171 
 172 #define CURRENT_VALID \
 173         (CURRENT && MAJOR(CURRENT -> dev) == MAJOR_NR \
 174          && CURRENT -> cmd == READ && CURRENT -> sector != -1)
 175 
 176 
 177 #undef  DEBUG_DRIVE_IF          /* Low level drive interface */
 178 #undef  DEBUG_COMMANDS          /* Commands sent to drive */
 179 #undef  DEBUG_VFS               /* VFS interface */
 180 #undef  DEBUG_CONV              /* Address conversions */
 181 #undef  DEBUG_TOC               /* Q-channel and Table of Contents */
 182 #undef  DEBUG_BUFFERS           /* Buffering and block size conversion */
 183 #undef  DEBUG_REQUEST           /* Request mechanism */
 184 #undef  DEBUG_STATE             /* State machine */
 185 
 186 
 187 /* Low level drive interface */
 188 
 189 /* Errors that can occur in the low level interface */
 190 #define ERR_IF_CMD_TIMEOUT      0x100
 191 #define ERR_IF_ERR_TIMEOUT      0x101
 192 #define ERR_IF_RESP_TIMEOUT     0x102
 193 #define ERR_IF_DATA_TIMEOUT     0x103
 194 #define ERR_IF_NOSTAT           0x104
 195 /* Errors in table of contents */
 196 #define ERR_TOC_MISSINGINFO     0x120
 197 #define ERR_TOC_MISSINGENTRY    0x121
 198 
 199 /* End .h defines */
 200 #endif _LINUX_OPTCD_H

/* [previous][next][first][last][top][bottom][index][help] */