The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/mcd/mcdreg.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright 1993 by Holger Veit (data part)
    3  * Copyright 1993 by Brian Moore (audio part)
    4  * Changes Copyright 1993 by Gary Clark II
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. All advertising materials mentioning features or use of this software
   16  *    must display the following acknowledgement:
   17  *      This software was developed by Holger Veit and Brian Moore
   18  *      for use with "386BSD" and similar operating systems.
   19  *    "Similar operating systems" includes mainly non-profit oriented
   20  *    systems for research and education, including but not restricted to
   21  *    "NetBSD", "FreeBSD", "Mach" (by CMU).
   22  * 4. Neither the name of the developer(s) nor the name "386BSD"
   23  *    may be used to endorse or promote products derived from this
   24  *    software without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER(S) ``AS IS'' AND ANY
   27  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE DEVELOPER(S) BE
   30  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
   31  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
   32  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
   33  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
   34  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   35  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   36  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   37  *
   38  * This file contains definitions for some cdrom control commands
   39  * and status codes. This info was "inherited" from the DOS MTMCDE.SYS
   40  * driver, and is thus not complete (and may even be wrong). Some day
   41  * the manufacturer or anyone else might provide better documentation,
   42  * so this file (and the driver) will then have a better quality.
   43  *
   44  * $FreeBSD$
   45  */
   46 
   47 #ifndef MCD_H
   48 #define MCD_H
   49 
   50 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
   51 #if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
   52 #pragma pack(1)
   53 #endif
   54 #endif
   55 
   56 /* toc */
   57 #define MCD_MAXTOCS     104     /* from the Linux driver */
   58 #define MCD_LASTPLUS1   170     /* special toc entry */
   59 
   60 typedef unsigned char   bcd_t;
   61 #define M_msf(msf)      msf[0]
   62 #define S_msf(msf)      msf[1]
   63 #define F_msf(msf)      msf[2]
   64 
   65 /* io lines used */
   66 #define MCD_IO_BASE     0x300
   67 
   68 #define MCD_REG_COMMAND 0
   69 #define MCD_REG_STATUS  0
   70 #define MCD_REG_RDATA   0
   71 
   72 #define MCD_REG_RESET   1
   73 #define MCD_REG_CTL2    2       /* XXX Is this right? */
   74 #define MCD_REG_CONFIG  3
   75 
   76 #define MCD_MASK_DMA    0x07    /* bits 2-0 = DMA channel */
   77 #define MCD_MASK_IRQ    0x70    /* bits 6-4 = INT number */
   78                                 /* 001 = int 2,9 */
   79                                 /* 010 = int 3 */
   80                                 /* 011 = int 5 */
   81                                 /* 100 = int 10 */
   82                                 /* 101 = int 11 */
   83 /* flags */
   84 #define MFL_DATA_NOT_AVAIL      0x02
   85 #define MFL_STATUS_NOT_AVAIL    0x04
   86 
   87 /* New Commands */
   88 #define M_RESET         0x00
   89 #define M_PICKLE        0x04
   90 
   91 /* ports */
   92 #define MCD_DATA        0
   93 #define MCD_FLAGS       1
   94 #define MCD_CTRL        2
   95 #define CHANNEL         3       /* XXX ??? */
   96 
   97 /* Status bits */
   98 #define MCD_ST_DOOROPEN         0x80
   99 #define MCD_ST_DSKIN            0x40
  100 #define MCD_ST_DSKCHNG          0x20
  101 #define MCD_ST_SPINNING         0x10
  102 #define MCD_ST_AUDIODISK        0x08    /* Audio Disk is in */
  103 #define MCD_ST_BUSY             0x04
  104 #define MCD_ST_AUDIOBSY         0x02    /* Audio Disk is Playing */
  105 #define MCD_ST_CMDCHECK         0x01    /* Command error */
  106 
  107 /* commands known by the controller */
  108 #define MCD_CMDRESET            0x00
  109 #define MCD_CMDGETVOLINFO       0x10    /* gets mcd_volinfo */
  110 #define MCD_CMDGETDISKINFO      0x11    /* gets mcd_disk information */
  111 #define MCD_CMDGETQCHN          0x20    /* gets mcd_qchninfo */
  112 #define MCD_CMDGETSENSE         0x30    /* gets sense info */
  113 #define MCD_CMDGETSTAT          0x40    /* gets a byte of status */
  114 
  115 #define MCD_CMDSETMODE          0x50    /* set transmission mode, needs byte */
  116 
  117 #define MCD_MDBIT_TESTMODE      0x80    /* 0 = DATALENGTH setting is valid */
  118 #define MCD_MDBIT_DATALENGTH    0x40    /* 0 = Read User Data Only */
  119                                         /* 1 = Read Raw sectors (2352 bytes) */
  120 
  121 #define MCDBLK  2048                            /* for cooked mode */
  122 #define MCDRBLK sizeof(struct mcd_rawsector)    /* for raw mode */
  123 
  124 #define MCD_MDBIT_ECCMODE       0x20    /* 0 = Use secondary correction */
  125                                         /* 1 = Don't use secondary ECC */
  126 #define MCD_MDBIT_SPINDOWN      0x08    /* 0 = Spin Up, 1 = Spin Down */
  127 #define MCD_MDBIT_GET_TOC       0x04    /* 0 = Get UPC on next GETQCHAN */
  128                                         /* 1 = Get TOC on GETQCHAN */
  129 #define MCD_MDBIT_MUTEDATA      0x01    /* 1 = Don't play back Data as audio */
  130 
  131 #define MCD_MD_RAW              (MCD_MDBIT_DATALENGTH|MCD_MDBIT_ECCMODE|MCD_MDBIT_MUTEDATA)
  132 #define MCD_MD_COOKED           (MCD_MDBIT_MUTEDATA)
  133 #define MCD_MD_TOC              (MCD_MDBIT_GET_TOC|MCD_MDBIT_MUTEDATA)
  134 
  135 #define MCD_CMDSTOPAUDIO        0x70
  136 #define MCD_CMDSTOPAUDIOTIME    0x80
  137 #define MCD_CMDGETVOLUME        0x8E    /* gets mcd_volume */
  138 #define MCD_CMDSETDRIVEMODE     0xA0    /* Set drive mode */
  139 #define MCD_READUPC             0xA2    /* Get UPC info */
  140 #define MCD_CMDSETVOLUME        0xAE    /* sets mcd_volume */
  141 #define MCD_CMDREAD1            0xB0    /* read n sectors */
  142 #define MCD_CMDSINGLESPEEDREAD  0xC0    /* read from-to */
  143 #define MCD_CMDSTARTAUDIOMSF    0xC1    /* read audio data */
  144 #define MCD_CMDDOUBLESPEEDREAD  0xC1    /* Read lots of data from the drive */
  145 #define MCD_CMDGETDRIVEMODE     0xC2    /* Get the drive mode */
  146 #define MCD_CMDREAD             0xC3    /* Read data from the drive */
  147 #define MCD_CMDSETINTERLEAVE    0xC8    /* Adjust the interleave */
  148 #define MCD_CMDCONTINFO         0xDC    /* Get controller info */
  149 #define MCD_CMDSTOP             0xF0    /* Stop everything */
  150 #define MCD_CMDEJECTDISK        0xF6
  151 #define MCD_CMDCLOSETRAY        0xF8
  152 
  153 #define MCD_CMDLOCKDRV          0xFE    /* needs byte */
  154 #define MCD_LK_UNLOCK   0x00
  155 #define MCD_LK_LOCK     0x01
  156 #define MCD_LK_TEST     0x02
  157 
  158 /* DMA Enable Stuff */
  159 #define MCD_DMA_IRQFLAGS        0x10    /* Set data0 for IRQ click */
  160 
  161 #define MCD_DMA_PREIRQ          0x01    /* All of these are for */
  162 #define MCD_DMA_POSTIRQ         0x02    /* MCD_DMA_IRQFLAG...   */
  163 #define MCD_DMA_ERRIRQ          0x04    /*                      */
  164 
  165 #define MCD_DMA_TIMEOUT         0x08    /* Set data0 for DMA timeout */
  166 #define MCD_DMA_UPCFLAG         0x04    /* 1 = Next command will be READUPC */
  167 
  168 #define MCD_DMA_DMAMODE         0x02    /* 1 = Data uses DMA */
  169 #define MCD_DMA_TRANSFERLENGTH  0x01    /* data0 = MSB, data1 = LSB of block length */
  170 
  171 struct mcd_dma_mode {
  172         u_char  dma_mode;
  173         u_char  data0;          /* If dma_mode & 0x10: Use IRQ settings */
  174         u_char  data1;          /* Used if dma_mode & 0x01 */
  175 };
  176 
  177 struct mcd_volinfo {
  178         bcd_t   trk_low;
  179         bcd_t   trk_high;
  180         bcd_t   vol_msf[3];
  181         bcd_t   trk1_msf[3];
  182 };
  183 
  184 struct mcd_qchninfo {
  185         u_char  addr_type:4;
  186         u_char  control:4;
  187         u_char  trk_no;
  188         u_char  idx_no;
  189         bcd_t   trk_size_msf[3];
  190         u_char  :8;
  191         bcd_t   hd_pos_msf[3];
  192 };
  193 
  194 struct mcd_volume {
  195         u_char  v0l;
  196         u_char  v0rs;
  197         u_char  v0r;
  198         u_char  v0ls;
  199 };
  200 
  201 struct mcd_holdtime {
  202         u_char  units_of_ten_seconds;
  203                         /* If this is 0, the default (12) is used */
  204 };
  205 
  206 struct mcd_read1 {
  207         bcd_t   start_msf[3];
  208         u_char  nsec[3];
  209 };
  210 
  211 struct mcd_read2 {
  212         bcd_t   start_msf[3];
  213         bcd_t   end_msf[3];
  214 };
  215 
  216 struct mcd_rawsector {
  217         u_char sync1[12];
  218         u_char header[4];
  219         u_char subheader1[4];
  220         u_char subheader2[4];
  221         u_char data[MCDBLK];
  222         u_char ecc_bits[280];
  223 };
  224 
  225 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
  226 #if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
  227 #pragma pack(4)
  228 #endif
  229 #endif
  230 #endif /* MCD_H */

Cache object: bb2ddde8459b754ab78a57f23e603054


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.