OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [include/] [linux/] [sjcd.h] - Blame information for rev 1775

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 * Definitions for a Sanyo CD-ROM interface.
3
 *
4
 *   Copyright (C) 1995  Vadim V. Model
5
 *                                       model@cecmow.enet.dec.com
6
 *                                       vadim@rbrf.msk.su
7
 *                                       vadim@ipsun.ras.ru
8
 *                       Eric van der Maarel
9
 *                                       H.T.M.v.d.Maarel@marin.nl
10
 *
11
 *  This information is based on mcd.c from M. Harriss and sjcd102.lst from
12
 *  E. Moenkeberg.
13
 *
14
 *  This program is free software; you can redistribute it and/or modify
15
 *  it under the terms of the GNU General Public License as published by
16
 *  the Free Software Foundation; either version 2 of the License, or
17
 *  (at your option) any later version.
18
 *
19
 *  This program is distributed in the hope that it will be useful,
20
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 *  GNU General Public License for more details.
23
 *
24
 *  You should have received a copy of the GNU General Public License
25
 *  along with this program; if not, write to the Free Software
26
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
 */
28
 
29
#ifndef __SJCD_H__
30
#define __SJCD_H__
31
 
32
/*
33
 * Change this to set the I/O port address as default. More flexibility
34
 * come with setup implementation.
35
 */
36
#define SJCD_BASE_ADDR      0x340
37
 
38
/*
39
 * Change this to set the irq as default. Really SANYO do not use interrupts
40
 * at all.
41
 */
42
#define SJCD_INTR_NR        0
43
 
44
/*
45
 * Change this to set the dma as default value. really SANYO does not use
46
 * direct memory access at all.
47
 */
48
#define SJCD_DMA_NR         0
49
 
50
/*
51
 * Macros which allow us to find out the status of the drive.
52
 */
53
#define SJCD_STATUS_AVAILABLE( x ) (((x)&0x02)==0)
54
#define SJCD_DATA_AVAILABLE( x )   (((x)&0x01)==0)
55
 
56
/*
57
 * Port access macro. Three ports are available: S-data port (command port),
58
 * status port (read only) and D-data port (read only).
59
 */
60
#define SJCDPORT( x )       ( sjcd_base + ( x ) )
61
#define SJCD_STATUS_PORT    SJCDPORT( 1 )
62
#define SJCD_S_DATA_PORT    SJCDPORT( 0 )
63
#define SJCD_COMMAND_PORT   SJCDPORT( 0 )
64
#define SJCD_D_DATA_PORT    SJCDPORT( 2 )
65
 
66
/*
67
 * Drive info bits. Drive info available as first (mandatory) byte of
68
 * command completion status.
69
 */
70
#define SST_NOT_READY       0x10        /* no disk in the drive (???) */
71
#define SST_MEDIA_CHANGED   0x20        /* disk is changed */
72
#define SST_DOOR_OPENED     0x40        /* door is open */
73
 
74
/* commands */
75
 
76
#define SCMD_EJECT_TRAY     0xD0        /* eject tray if not locked */
77
#define SCMD_LOCK_TRAY      0xD2        /* lock tray when in */
78
#define SCMD_UNLOCK_TRAY    0xD4        /* unlock tray when in */
79
#define SCMD_CLOSE_TRAY     0xD6        /* load tray in */
80
 
81
#define SCMD_RESET          0xFA        /* soft reset */
82
#define SCMD_GET_STATUS     0x80
83
#define SCMD_GET_VERSION    0xCC
84
 
85
#define SCMD_DATA_READ      0xA0        /* are the same, depend on mode&args */
86
#define SCMD_SEEK           0xA0
87
#define SCMD_PLAY           0xA0
88
 
89
#define SCMD_GET_QINFO      0xA8
90
 
91
#define SCMD_SET_MODE       0xC4
92
#define SCMD_MODE_PLAY      0xE0
93
#define SCMD_MODE_COOKED    (0xF8 & ~0x20)
94
#define SCMD_MODE_RAW       0xF9
95
#define SCMD_MODE_x20_BIT   0x20        /* What is it for ? */
96
 
97
#define SCMD_SET_VOLUME     0xAE
98
#define SCMD_PAUSE          0xE0
99
#define SCMD_STOP           0xE0
100
 
101
#define SCMD_GET_DISK_INFO  0xAA
102
 
103
/*
104
 * Some standard arguments for SCMD_GET_DISK_INFO.
105
 */
106
#define SCMD_GET_1_TRACK    0xA0    /* get the first track information */
107
#define SCMD_GET_L_TRACK    0xA1    /* get the last track information */
108
#define SCMD_GET_D_SIZE     0xA2    /* get the whole disk information */
109
 
110
/*
111
 * Borrowed from hd.c. Allows to optimize multiple port read commands.
112
 */
113
#define S_READ_DATA( port, buf, nr )      insb( port, buf, nr )
114
 
115
/*
116
 * We assume that there are no audio disks with TOC length more than this
117
 * number (I personally have never seen disks with more than 20 fragments).
118
 */
119
#define SJCD_MAX_TRACKS         100
120
 
121
struct msf {
122
  unsigned char   min;
123
  unsigned char   sec;
124
  unsigned char   frame;
125
};
126
 
127
struct sjcd_hw_disk_info {
128
  unsigned char track_control;
129
  unsigned char track_no;
130
  unsigned char x, y, z;
131
  union {
132
    unsigned char track_no;
133
    struct msf track_msf;
134
  } un;
135
};
136
 
137
struct sjcd_hw_qinfo {
138
  unsigned char track_control;
139
  unsigned char track_no;
140
  unsigned char x;
141
  struct msf rel;
142
  struct msf abs;
143
};
144
 
145
struct sjcd_play_msf {
146
  struct msf  start;
147
  struct msf  end;
148
};
149
 
150
struct sjcd_disk_info {
151
  unsigned char   first;
152
  unsigned char   last;
153
  struct msf      disk_length;
154
  struct msf      first_track;
155
};
156
 
157
struct sjcd_toc {
158
  unsigned char   ctrl_addr;
159
  unsigned char   track;
160
  unsigned char   point_index;
161
  struct msf      track_time;
162
  struct msf      disk_time;
163
};
164
 
165
#if defined( SJCD_GATHER_STAT )
166
 
167
struct sjcd_stat {
168
  int ticks;
169
  int tticks[ 8 ];
170
  int idle_ticks;
171
  int start_ticks;
172
  int mode_ticks;
173
  int read_ticks;
174
  int data_ticks;
175
  int stop_ticks;
176
  int stopping_ticks;
177
};
178
 
179
#endif
180
 
181
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.