/[debburn]/nonameyet/branches/cleanup/cdrecord/drv_philips.c
ViewVC logotype

Contents of /nonameyet/branches/cleanup/cdrecord/drv_philips.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 368 - (show annotations) (download)
Thu Oct 12 19:38:29 2006 UTC (6 years, 8 months ago) by kaner-guest
File MIME type: text/plain
File size: 35936 byte(s)
* Cleaned up K&R function definitions [except libschily]
* Cleaned up __PR makros [except libschily]
1 /*
2 * This file has been modified for the cdrkit suite.
3 *
4 * The behaviour and appearence of the program code below can differ to a major
5 * extent from the version distributed by the original author(s).
6 *
7 * For details, see Changelog file distributed with the cdrkit package. If you
8 * received this file from another source then ask the distributing person for
9 * a log of modifications.
10 *
11 */
12
13 /* @(#)drv_philips.c 1.69 05/05/16 Copyright 1997-2005 J. Schilling */
14 #ifndef lint
15 static char sccsid[] =
16 "@(#)drv_philips.c 1.69 05/05/16 Copyright 1997-2005 J. Schilling";
17 #endif
18 /*
19 * CDR device implementation for
20 * Philips/Yamaha/Ricoh/Plasmon
21 *
22 * Copyright (c) 1997-2005 J. Schilling
23 */
24 /*
25 * This program is free software; you can redistribute it and/or modify
26 * it under the terms of the GNU General Public License version 2
27 * as published by the Free Software Foundation.
28 *
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
33 *
34 * You should have received a copy of the GNU General Public License along with
35 * this program; see the file COPYING. If not, write to the Free Software
36 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
37 */
38
39 #include <mconfig.h>
40
41 #include <stdio.h>
42 #include <unixstd.h> /* Include sys/types.h to make off_t available */
43 #include <standard.h>
44 #include <intcvt.h>
45 #include <schily.h>
46
47 #include <scg/scsireg.h>
48 #include <scg/scsitransp.h>
49 #include <scg/scgcmd.h>
50 #include <scg/scsidefs.h> /* XXX Only for DEV_RICOH_RO_1060C */
51
52 #include "cdrecord.h"
53
54 extern int debug;
55 extern int lverbose;
56
57 static int load_unload_philips(SCSI *scgp, int);
58 static int philips_load(SCSI *scgp, cdr_t *dp);
59 static int philips_unload(SCSI *scgp, cdr_t *dp);
60 static int philips_dumbload(SCSI *scgp, cdr_t *dp);
61 static int philips_dumbunload(SCSI *scgp, cdr_t *dp);
62 static int plasmon_buf(SCSI *, long *, long *);
63 static int recover_philips(SCSI *scgp, cdr_t *dp, int);
64 static int speed_select_yamaha(SCSI *scgp, cdr_t *dp, int *speedp);
65 static int speed_select_philips(SCSI *scgp, cdr_t *dp, int *speedp);
66 static int speed_select_oldphilips(SCSI *scgp, cdr_t *dp, int *speedp);
67 static int speed_select_dumbphilips(SCSI *scgp, cdr_t *dp, int *speedp);
68 static int speed_select_pioneer(SCSI *scgp, cdr_t *dp, int *speedp);
69 static int philips_init(SCSI *scgp, cdr_t *dp);
70 static int philips_getdisktype(SCSI *scgp, cdr_t *dp);
71 static BOOL capacity_philips(SCSI *scgp, long *lp);
72 static int first_writable_addr_philips(SCSI *scgp, long *, int, int, int,
73 int);
74 static int next_wr_addr_philips(SCSI *scgp, track_t *trackp, long *ap);
75 static int reserve_track_philips(SCSI *scgp, unsigned long);
76 static int scsi_cdr_write_philips(SCSI *scgp, caddr_t bp, long sectaddr,
77 long size, int blocks, BOOL islast);
78 static int write_track_info_philips(SCSI *scgp, int);
79 static int write_track_philips(SCSI *scgp, long, int);
80 static int open_track_philips(SCSI *scgp, cdr_t *dp, track_t *trackp);
81 static int open_track_plasmon(SCSI *scgp, cdr_t *dp, track_t *trackp);
82 static int open_track_oldphilips(SCSI *scgp, cdr_t *dp, track_t *trackp);
83 static int open_track_yamaha(SCSI *scgp, cdr_t *dp, track_t *trackp);
84 static int close_track_philips(SCSI *scgp, cdr_t *dp, track_t *trackp);
85 static int fixation_philips(SCSI *scgp, cdr_t *dp, track_t *trackp);
86
87 static int philips_attach(SCSI *scgp, cdr_t *);
88 static int plasmon_attach(SCSI *scgp, cdr_t *);
89 static int ricoh_attach(SCSI *scgp, cdr_t *);
90 static int philips_getlilo(SCSI *scgp, long *lilenp, long *lolenp);
91
92
93 struct cdd_52x_mode_page_21 { /* write track information */
94 MP_P_CODE; /* parsave & pagecode */
95 Uchar p_len; /* 0x0E = 14 Bytes */
96 Uchar res_2;
97 Uchar sectype;
98 Uchar track;
99 Uchar ISRC[9];
100 Uchar res[2];
101 };
102
103 struct cdd_52x_mode_page_23 { /* speed selection */
104 MP_P_CODE; /* parsave & pagecode */
105 Uchar p_len; /* 0x06 = 6 Bytes */
106 Uchar speed;
107 Uchar dummy;
108 Uchar res[4];
109
110 };
111
112 #if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
113
114 struct yamaha_mode_page_31 { /* drive configuration */
115 MP_P_CODE; /* parsave & pagecode */
116 Uchar p_len; /* 0x02 = 2 Bytes */
117 Uchar res;
118 Ucbit dummy : 4;
119 Ucbit speed : 4;
120 };
121
122 #else /* Motorola byteorder */
123
124 struct yamaha_mode_page_31 { /* drive configuration */
125 MP_P_CODE; /* parsave & pagecode */
126 Uchar p_len; /* 0x02 = 2 Bytes */
127 Uchar res;
128 Ucbit speed : 4;
129 Ucbit dummy : 4;
130 };
131 #endif
132
133 struct cdd_52x_mode_data {
134 struct scsi_mode_header header;
135 union cdd_pagex {
136 struct cdd_52x_mode_page_21 page21;
137 struct cdd_52x_mode_page_23 page23;
138 struct yamaha_mode_page_31 page31;
139 } pagex;
140 };
141
142
143 cdr_t cdr_philips_cdd521O = {
144 0, 0,
145 CDR_TAO|CDR_TRAYLOAD,
146 CDR_CDRW_NONE,
147 2, 2,
148 "philips_cdd521_old",
149 "driver for Philips old CDD-521",
150 0,
151 (dstat_t *)0,
152 drive_identify,
153 philips_attach,
154 philips_init,
155 philips_getdisktype,
156 philips_load,
157 philips_unload,
158 buf_dummy,
159 recovery_needed,
160 recover_philips,
161 speed_select_oldphilips,
162 select_secsize,
163 next_wr_addr_philips,
164 reserve_track_philips,
165 scsi_cdr_write_philips,
166 (int(*)(track_t *, void *, BOOL))cmd_dummy, /* gen_cue */
167 no_sendcue,
168 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy, /* leadin */
169 open_track_oldphilips,
170 close_track_philips,
171 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy,
172 cmd_dummy,
173 cmd_dummy, /* abort */
174 read_session_offset_philips,
175 fixation_philips,
176 cmd_dummy, /* stats */
177 blank_dummy,
178 format_dummy,
179 (int(*)(SCSI *, caddr_t, int, int))NULL, /* no OPC */
180 cmd_dummy, /* opt1 */
181 cmd_dummy, /* opt2 */
182 };
183
184 cdr_t cdr_philips_dumb = {
185 0, 0,
186 CDR_TAO|CDR_TRAYLOAD,
187 CDR_CDRW_NONE,
188 2, 2,
189 "philips_dumb",
190 "driver for Philips CDD-521 with pessimistic assumptions",
191 0,
192 (dstat_t *)0,
193 drive_identify,
194 philips_attach,
195 philips_init,
196 philips_getdisktype,
197 philips_dumbload,
198 philips_dumbunload,
199 buf_dummy,
200 recovery_needed,
201 recover_philips,
202 speed_select_dumbphilips,
203 select_secsize,
204 next_wr_addr_philips,
205 reserve_track_philips,
206 scsi_cdr_write_philips,
207 (int(*)(track_t *, void *, BOOL))cmd_dummy, /* gen_cue */
208 no_sendcue,
209 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy, /* leadin */
210 open_track_oldphilips,
211 close_track_philips,
212 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy,
213 cmd_dummy,
214 cmd_dummy, /* abort */
215 read_session_offset_philips,
216 fixation_philips,
217 cmd_dummy, /* stats */
218 blank_dummy,
219 format_dummy,
220 (int(*)(SCSI *, caddr_t, int, int))NULL, /* no OPC */
221 cmd_dummy, /* opt1 */
222 cmd_dummy, /* opt2 */
223 };
224
225 cdr_t cdr_philips_cdd521 = {
226 0, 0,
227 CDR_TAO|CDR_TRAYLOAD,
228 CDR_CDRW_NONE,
229 2, 2,
230 "philips_cdd521",
231 "driver for Philips CDD-521",
232 0,
233 (dstat_t *)0,
234 drive_identify,
235 philips_attach,
236 philips_init,
237 philips_getdisktype,
238 philips_load,
239 philips_unload,
240 buf_dummy,
241 recovery_needed,
242 recover_philips,
243 speed_select_philips,
244 select_secsize,
245 next_wr_addr_philips,
246 reserve_track_philips,
247 scsi_cdr_write_philips,
248 (int(*)(track_t *, void *, BOOL))cmd_dummy, /* gen_cue */
249 no_sendcue,
250 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy, /* leadin */
251 open_track_philips,
252 close_track_philips,
253 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy,
254 cmd_dummy,
255 cmd_dummy, /* abort */
256 read_session_offset_philips,
257 fixation_philips,
258 cmd_dummy, /* stats */
259 blank_dummy,
260 format_dummy,
261 (int(*)(SCSI *, caddr_t, int, int))NULL, /* no OPC */
262 cmd_dummy, /* opt1 */
263 cmd_dummy, /* opt2 */
264 };
265
266 cdr_t cdr_philips_cdd522 = {
267 0, 0,
268 /* CDR_TAO|CDR_SAO|CDR_TRAYLOAD,*/
269 CDR_TAO|CDR_TRAYLOAD,
270 CDR_CDRW_NONE,
271 2, 2,
272 "philips_cdd522",
273 "driver for Philips CDD-522",
274 0,
275 (dstat_t *)0,
276 drive_identify,
277 philips_attach,
278 philips_init,
279 philips_getdisktype,
280 philips_load,
281 philips_unload,
282 buf_dummy,
283 recovery_needed,
284 recover_philips,
285 speed_select_philips,
286 select_secsize,
287 next_wr_addr_philips,
288 reserve_track_philips,
289 scsi_cdr_write_philips,
290 (int(*)(track_t *, void *, BOOL))cmd_dummy, /* gen_cue */
291 no_sendcue,
292 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy, /* leadin */
293 open_track_philips,
294 close_track_philips,
295 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy,
296 cmd_dummy,
297 cmd_dummy, /* abort */
298 read_session_offset_philips,
299 fixation_philips,
300 cmd_dummy, /* stats */
301 blank_dummy,
302 format_dummy,
303 (int(*)(SCSI *, caddr_t, int, int))NULL, /* no OPC */
304 cmd_dummy, /* opt1 */
305 cmd_dummy, /* opt2 */
306 };
307
308 cdr_t cdr_tyuden_ew50 = {
309 0, 0,
310 CDR_TAO|CDR_TRAYLOAD|CDR_SWABAUDIO,
311 CDR_CDRW_NONE,
312 2, 2,
313 "tyuden_ew50",
314 "driver for Taiyo Yuden EW-50",
315 0,
316 (dstat_t *)0,
317 drive_identify,
318 philips_attach,
319 philips_init,
320 philips_getdisktype,
321 philips_load,
322 philips_unload,
323 buf_dummy,
324 recovery_needed,
325 recover_philips,
326 speed_select_philips,
327 select_secsize,
328 next_wr_addr_philips,
329 reserve_track_philips,
330 scsi_cdr_write_philips,
331 (int(*)(track_t *, void *, BOOL))cmd_dummy, /* gen_cue */
332 no_sendcue,
333 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy, /* leadin */
334 open_track_philips,
335 close_track_philips,
336 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy,
337 cmd_dummy,
338 cmd_dummy, /* abort */
339 read_session_offset_philips,
340 fixation_philips,
341 cmd_dummy, /* stats */
342 blank_dummy,
343 format_dummy,
344 (int(*)(SCSI *, caddr_t, int, int))NULL, /* no OPC */
345 cmd_dummy, /* opt1 */
346 cmd_dummy, /* opt2 */
347 };
348
349 cdr_t cdr_kodak_pcd600 = {
350 0, 0,
351 CDR_TAO|CDR_TRAYLOAD,
352 CDR_CDRW_NONE,
353 6, 6,
354 "kodak_pcd_600",
355 "driver for Kodak PCD-600",
356 0,
357 (dstat_t *)0,
358 drive_identify,
359 philips_attach,
360 philips_init,
361 philips_getdisktype,
362 philips_load,
363 philips_unload,
364 buf_dummy,
365 recovery_needed,
366 recover_philips,
367 speed_select_philips,
368 select_secsize,
369 next_wr_addr_philips,
370 reserve_track_philips,
371 scsi_cdr_write_philips,
372 (int(*)(track_t *, void *, BOOL))cmd_dummy, /* gen_cue */
373 no_sendcue,
374 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy, /* leadin */
375 open_track_oldphilips,
376 close_track_philips,
377 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy,
378 cmd_dummy,
379 cmd_dummy, /* abort */
380 read_session_offset_philips,
381 fixation_philips,
382 cmd_dummy, /* stats */
383 blank_dummy,
384 format_dummy,
385 (int(*)(SCSI *, caddr_t, int, int))NULL, /* no OPC */
386 cmd_dummy, /* opt1 */
387 cmd_dummy, /* opt2 */
388 };
389
390 cdr_t cdr_plasmon_rf4100 = {
391 0, 0,
392 CDR_TAO|CDR_TRAYLOAD,
393 CDR_CDRW_NONE,
394 2, 4,
395 "plasmon_rf4100",
396 "driver for Plasmon RF 4100",
397 0,
398 (dstat_t *)0,
399 drive_identify,
400 plasmon_attach,
401 philips_init,
402 philips_getdisktype,
403 philips_load,
404 philips_unload,
405 plasmon_buf,
406 recovery_needed,
407 recover_philips,
408 speed_select_philips,
409 select_secsize,
410 next_wr_addr_philips,
411 reserve_track_philips,
412 scsi_cdr_write_philips,
413 (int(*)(track_t *, void *, BOOL))cmd_dummy, /* gen_cue */
414 no_sendcue,
415 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy, /* leadin */
416 open_track_plasmon,
417 close_track_philips,
418 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy,
419 cmd_dummy,
420 cmd_dummy, /* abort */
421 read_session_offset_philips,
422 fixation_philips,
423 cmd_dummy, /* stats */
424 blank_dummy,
425 format_dummy,
426 (int(*)(SCSI *, caddr_t, int, int))NULL, /* no OPC */
427 cmd_dummy, /* opt1 */
428 cmd_dummy, /* opt2 */
429 };
430
431 cdr_t cdr_pioneer_dw_s114x = {
432 0, 0,
433 CDR_TAO|CDR_TRAYLOAD|CDR_SWABAUDIO,
434 CDR_CDRW_NONE,
435 2, 4,
436 "pioneer_dws114x",
437 "driver for Pioneer DW-S114X",
438 0,
439 (dstat_t *)0,
440 drive_identify,
441 philips_attach,
442 philips_init,
443 philips_getdisktype,
444 scsi_load,
445 scsi_unload,
446 buf_dummy,
447 recovery_needed,
448 recover_philips,
449 speed_select_pioneer,
450 select_secsize,
451 next_wr_addr_philips,
452 reserve_track_philips,
453 scsi_cdr_write_philips,
454 (int(*)(track_t *, void *, BOOL))cmd_dummy, /* gen_cue */
455 no_sendcue,
456 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy, /* leadin */
457 /* open_track_yamaha,*/
458 /*???*/ open_track_oldphilips,
459 close_track_philips,
460 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy,
461 cmd_dummy,
462 cmd_dummy, /* abort */
463 read_session_offset_philips,
464 fixation_philips,
465 cmd_dummy, /* stats */
466 blank_dummy,
467 format_dummy,
468 (int(*)(SCSI *, caddr_t, int, int))NULL, /* no OPC */
469 cmd_dummy, /* opt1 */
470 cmd_dummy, /* opt2 */
471 };
472
473 cdr_t cdr_yamaha_cdr100 = {
474 0, 0,
475 /* CDR_TAO|CDR_SAO|CDR_CADDYLOAD|CDR_SWABAUDIO,*/
476 CDR_TAO|CDR_CADDYLOAD|CDR_SWABAUDIO,
477 CDR_CDRW_NONE,
478 2, 4,
479 "yamaha_cdr100",
480 "driver for Yamaha CDR-100 / CDR-102",
481 0,
482 (dstat_t *)0,
483 drive_identify,
484 philips_attach,
485 philips_init,
486 drive_getdisktype,
487 scsi_load,
488 philips_unload,
489 buf_dummy,
490 recovery_needed,
491 recover_philips,
492 speed_select_yamaha,
493 select_secsize,
494 next_wr_addr_philips,
495 reserve_track_philips,
496 scsi_cdr_write_philips,
497 (int(*)(track_t *, void *, BOOL))cmd_dummy, /* gen_cue */
498 no_sendcue,
499 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy, /* leadin */
500 open_track_yamaha,
501 close_track_philips,
502 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy,
503 cmd_dummy,
504 cmd_dummy, /* abort */
505 read_session_offset_philips,
506 fixation_philips,
507 cmd_dummy, /* stats */
508 blank_dummy,
509 format_dummy,
510 (int(*)(SCSI *, caddr_t, int, int))NULL, /* no OPC */
511 cmd_dummy, /* opt1 */
512 cmd_dummy, /* opt2 */
513 };
514
515 cdr_t cdr_ricoh_ro1060 = {
516 0, 0,
517 /* CDR_TAO|CDR_SAO|CDR_CADDYLOAD,*/
518 CDR_TAO|CDR_CADDYLOAD,
519 CDR_CDRW_NONE,
520 2, 2,
521 "ricoh_ro1060c",
522 "driver for Ricoh RO-1060C",
523 0,
524 (dstat_t *)0,
525 drive_identify,
526 ricoh_attach,
527 philips_init,
528 philips_getdisktype,
529 scsi_load,
530 scsi_unload,
531 buf_dummy,
532 recovery_needed,
533 recover_philips,
534 speed_select_yamaha,
535 select_secsize,
536 next_wr_addr_philips,
537 reserve_track_philips,
538 scsi_cdr_write_philips,
539 (int(*)(track_t *, void *, BOOL))cmd_dummy, /* gen_cue */
540 no_sendcue,
541 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy, /* leadin */
542 open_track_philips,
543 close_track_philips,
544 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy,
545 cmd_dummy,
546 cmd_dummy, /* abort */
547 read_session_offset_philips,
548 fixation_philips,
549 cmd_dummy, /* stats */
550 blank_dummy,
551 format_dummy,
552 (int(*)(SCSI *, caddr_t, int, int))NULL, /* no OPC */
553 cmd_dummy, /* opt1 */
554 cmd_dummy, /* opt2 */
555 };
556
557 cdr_t cdr_ricoh_ro1420 = {
558 0, 0,
559 /* CDR_TAO|CDR_SAO|CDR_CADDYLOAD,*/
560 CDR_TAO|CDR_CADDYLOAD,
561 CDR_CDRW_NONE,
562 2, 2,
563 "ricoh_ro1420c",
564 "driver for Ricoh RO-1420C",
565 0,
566 (dstat_t *)0,
567 drive_identify,
568 ricoh_attach,
569 philips_init,
570 philips_getdisktype,
571 scsi_load,
572 scsi_unload,
573 buf_dummy,
574 recovery_needed,
575 recover_philips,
576 speed_select_yamaha,
577 select_secsize,
578 next_wr_addr_philips,
579 reserve_track_philips,
580 scsi_cdr_write_philips,
581 (int(*)(track_t *, void *, BOOL))cmd_dummy, /* gen_cue */
582 no_sendcue,
583 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy, /* leadin */
584 open_track_philips,
585 close_track_philips,
586 (int(*)(SCSI *, cdr_t *, track_t *))cmd_dummy,
587 cmd_dummy,
588 cmd_dummy, /* abort */
589 read_session_offset_philips,
590 fixation_philips,
591 cmd_dummy, /* stats */
592 blank_dummy,
593 format_dummy,
594 (int(*)(SCSI *, caddr_t, int, int))NULL, /* no OPC */
595 cmd_dummy, /* opt1 */
596 cmd_dummy, /* opt2 */
597 };
598
599
600 static int load_unload_philips(SCSI *scgp, int load)
601 {
602 register struct scg_cmd *scmd = scgp->scmd;
603
604 fillbytes((caddr_t)scmd, sizeof (*scmd), '\0');
605 scmd->flags = SCG_DISRE_ENA;
606 scmd->cdb_len = SC_G1_CDBLEN;
607 scmd->sense_len = CCS_SENSE_LEN;
608 scmd->cdb.g1_cdb.cmd = 0xE7;
609 scmd->cdb.g1_cdb.lun = scg_lun(scgp);
610 scmd->cdb.g1_cdb.count[1] = !load;
611
612 scgp->cmdname = "philips medium load/unload";
613
614 if (scg_cmd(scgp) < 0)
615 return (-1);
616 return (0);
617 }
618
619 static int
620 philips_load(SCSI *scgp, cdr_t *dp)
621 {
622 return (load_unload_philips(scgp, 1));
623 }
624
625 static int
626 philips_unload(SCSI *scgp, cdr_t *dp)
627 {
628 return (load_unload_philips(scgp, 0));
629 }
630
631 static int
632 philips_dumbload(SCSI *scgp, cdr_t *dp)
633 {
634 int ret;
635
636 scgp->silent++;
637 ret = load_unload_philips(scgp, 1);
638 scgp->silent--;
639 if (ret < 0)
640 return (scsi_load(scgp, dp));
641 return (0);
642 }
643
644 static int
645 philips_dumbunload(SCSI *scgp, cdr_t *dp)
646 {
647 int ret;
648
649 scgp->silent++;
650 ret = load_unload_philips(scgp, 0);
651 scgp->silent--;
652 if (ret < 0)
653 return (scsi_unload(scgp, dp));
654 return (0);
655 }
656
657 static int
658 plasmon_buf(SCSI *scgp,
659 long *sp /* Size pointer */,
660 long *fp /* Free space pointer */)
661 {
662 /*
663 * There's no way to obtain these values from the
664 * Plasmon RF41xx devices. This function stub is only
665 * present to prevent cdrecord.c from calling the READ BUFFER
666 * SCSI cmd which is implemented non standard compliant in
667 * the Plasmon drive. Calling READ BUFFER would only jam the Plasmon
668 * as the non standard implementation in the Plasmon firmware
669 * expects different parameters.
670 */
671
672 if (sp)
673 *sp = 0L;
674 if (fp)
675 *fp = 0L;
676
677 return (100); /* 100 % */
678 }
679
680 static int
681 recover_philips(SCSI *scgp, cdr_t *dp, int track)
682 {
683 register struct scg_cmd *scmd = scgp->scmd;
684
685 fillbytes((caddr_t)scmd, sizeof (*scmd), '\0');
686 scmd->flags = SCG_DISRE_ENA;
687 scmd->cdb_len = SC_G1_CDBLEN;
688 scmd->sense_len = CCS_SENSE_LEN;
689 scmd->cdb.g1_cdb.cmd = 0xEC;
690 scmd->cdb.g1_cdb.lun = scg_lun(scgp);
691
692 scgp->cmdname = "philips recover";
693
694 if (scg_cmd(scgp) < 0)
695 return (-1);
696 return (0);
697 }
698
699 static int
700 speed_select_yamaha(SCSI *scgp, cdr_t *dp, int *speedp)
701 {
702 struct scsi_mode_page_header *mp;
703 char mode[256];
704 int len = 16;
705 int page = 0x31;
706 struct yamaha_mode_page_31 *xp;
707 struct cdd_52x_mode_data md;
708 int count;
709 int speed = 1;
710 BOOL dummy = (dp->cdr_cmdflags & F_DUMMY) != 0;
711
712 if (speedp) {
713 speed = *speedp;
714 } else {
715 fillbytes((caddr_t)mode, sizeof (mode), '\0');
716
717 if (!get_mode_params(scgp, page, "Speed/Dummy information",
718 (Uchar *)mode, (Uchar *)0, (Uchar *)0, (Uchar *)0, &len)) {
719 return (-1);
720 }
721 if (len == 0)
722 return (-1);
723
724 mp = (struct scsi_mode_page_header *)
725 (mode + sizeof (struct scsi_mode_header) +
726 ((struct scsi_mode_header *)mode)->blockdesc_len);
727
728 xp = (struct yamaha_mode_page_31 *)mp;
729 speed = xp->speed;
730 }
731
732 fillbytes((caddr_t)&md, sizeof (md), '\0');
733
734 count = sizeof (struct scsi_mode_header) +
735 sizeof (struct yamaha_mode_page_31);
736
737 speed >>= 1;
738 md.pagex.page31.p_code = 0x31;
739 md.pagex.page31.p_len = 0x02;
740 md.pagex.page31.speed = speed;
741 md.pagex.page31.dummy = dummy?1:0;
742
743 return (mode_select(scgp, (Uchar *)&md, count, 0, scgp->inq->data_format >= 2));
744 }
745
746 static int
747 speed_select_philips(SCSI *scgp, cdr_t *dp, int *speedp)
748 {
749 struct scsi_mode_page_header *mp;
750 char mode[256];
751 int len = 20;
752 int page = 0x23;
753 struct cdd_52x_mode_page_23 *xp;
754 struct cdd_52x_mode_data md;
755 int count;
756 int speed = 1;
757 BOOL dummy = (dp->cdr_cmdflags & F_DUMMY) != 0;
758
759 if (speedp) {
760 speed = *speedp;
761 } else {
762 fillbytes((caddr_t)mode, sizeof (mode), '\0');
763
764 if (!get_mode_params(scgp, page, "Speed/Dummy information",
765 (Uchar *)mode, (Uchar *)0, (Uchar *)0, (Uchar *)0, &len)) {
766 return (-1);
767 }
768 if (len == 0)
769 return (-1);
770
771 mp = (struct scsi_mode_page_header *)
772 (mode + sizeof (struct scsi_mode_header) +
773 ((struct scsi_mode_header *)mode)->blockdesc_len);
774
775 xp = (struct cdd_52x_mode_page_23 *)mp;
776 speed = xp->speed;
777 }
778
779 fillbytes((caddr_t)&md, sizeof (md), '\0');
780
781 count = sizeof (struct scsi_mode_header) +
782 sizeof (struct cdd_52x_mode_page_23);
783
784 md.pagex.page23.p_code = 0x23;
785 md.pagex.page23.p_len = 0x06;
786 md.pagex.page23.speed = speed;
787 md.pagex.page23.dummy = dummy?1:0;
788
789 return (mode_select(scgp, (Uchar *)&md, count, 0, scgp->inq->data_format >= 2));
790 }
791
792 static int
793 speed_select_pioneer(SCSI *scgp, cdr_t *dp, int *speedp)
794 {
795 if (speedp != 0 && *speedp < 2) {
796 *speedp = 2;
797 if (lverbose)
798 printf("WARNING: setting to minimum speed (2).\n");
799 }
800 return (speed_select_philips(scgp, dp, speedp));
801 }
802
803 static int
804 speed_select_oldphilips(SCSI *scgp, cdr_t *dp, int *speedp)
805 {
806 BOOL dummy = (dp->cdr_cmdflags & F_DUMMY) != 0;
807
808 if (lverbose)
809 printf("WARNING: ignoring selected speed.\n");
810 if (dummy) {
811 errmsgno(EX_BAD, "Cannot set dummy writing for this device.\n");
812 return (-1);
813 }
814 return (0);
815 }
816
817 static int
818 speed_select_dumbphilips(SCSI *scgp, cdr_t *dp, int *speedp)
819 {
820 if (speed_select_philips(scgp, dp, speedp) < 0)
821 return (speed_select_oldphilips(scgp, dp, speedp));
822 return (0);
823 }
824
825 static int
826 philips_init(SCSI *scgp, cdr_t *dp)
827 {
828 return ((*dp->cdr_set_speed_dummy)(scgp, dp, NULL));
829 }
830
831
832 #define IS(what, flag) printf(" Is %s%s\n", flag?"":"not ", what);
833
834 static int
835 philips_getdisktype(SCSI *scgp, cdr_t *dp)
836 {
837 dstat_t *dsp = dp->cdr_dstat;
838 char sbuf[16];
839 long dummy;
840 long lilen;
841 long lolen;
842 msf_t msf;
843 int audio = -1;
844
845 scgp->silent++;
846 dummy = (*dp->cdr_next_wr_address)(scgp, (track_t *)0, &lilen);
847 scgp->silent--;
848
849 /*
850 * Check for "Command sequence error" first.
851 */
852 if ((dsp->ds_cdrflags & RF_WRITE) != 0 &&
853 dummy < 0 &&
854 (scg_sense_key(scgp) != SC_ILLEGAL_REQUEST ||
855 scg_sense_code(scgp) != 0x2C)) {
856 reload_media(scgp, dp);
857 }
858
859 scgp->silent++;
860 if (read_subchannel(scgp, sbuf, 0, 12, 0, 1, 0xf0) >= 0) {
861 if (sbuf[2] == 0 && sbuf[3] == 8)
862 audio = (sbuf[7] & 0x40) != 0;
863 }
864 scgp->silent--;
865
866 if ((dp->cdr_dstat->ds_cdrflags & RF_PRATIP) != 0 &&
867 dummy >= 0 && lilen == 0) {
868 scgp->silent++;
869 dummy = philips_getlilo(scgp, &lilen, &lolen);
870 scgp->silent--;
871
872 if (dummy >= 0) {
873 /* printf("lead-in len: %d lead-out len: %d\n", lilen, lolen);*/
874 lba_to_msf(-150 - lilen, &msf);
875
876 printf("ATIP info from disk:\n");
877 if (audio >= 0)
878 IS("unrestricted", audio);
879 if (audio == 1 || (audio == 0 && (sbuf[7] & 0x3F) != 0x3F))
880 printf(" Disk application code: %d\n", sbuf[7] & 0x3F);
881 printf(" ATIP start of lead in: %ld (%02d:%02d/%02d)\n",
882 -150 - lilen, msf.msf_min, msf.msf_sec, msf.msf_frame);
883
884 if (capacity_philips(scgp, &lolen)) {
885 lba_to_msf(lolen, &msf);
886 printf(
887 " ATIP start of lead out: %ld (%02d:%02d/%02d)\n",
888 lolen, msf.msf_min, msf.msf_sec, msf.msf_frame);
889 }
890 lba_to_msf(-150 - lilen, &msf);
891 pr_manufacturer(&msf,
892 FALSE, /* Always not erasable */
893 audio > 0); /* Audio from read subcode */
894 }
895 }
896
897 if (capacity_philips(scgp, &lolen)) {
898 dsp->ds_maxblocks = lolen;
899 dsp->ds_maxrblocks = disk_rcap(&msf, dsp->ds_maxblocks,
900 FALSE, /* Always not erasable */
901 audio > 0); /* Audio from read subcode */
902 }
903 scgp->silent++;
904 /*read_subchannel(scgp, bp, track, cnt, msf, subq, fmt); */
905
906 if (read_subchannel(scgp, sbuf, 0, 14, 0, 0, 0xf1) >= 0)
907 scg_prbytes("Disk bar code:", (Uchar *)sbuf, 14 - scg_getresid(scgp));
908 scgp->silent--;
909
910 return (drive_getdisktype(scgp, dp));
911 }
912
913 static BOOL
914 capacity_philips(SCSI *scgp, long *lp)
915 {
916 long l = 0L;
917 BOOL succeed = TRUE;
918
919 scgp->silent++;
920 if (read_B0(scgp, FALSE, NULL, &l) >= 0) {
921 if (debug)
922 printf("lead out B0: %ld\n", l);
923 *lp = l;
924 } else if (read_trackinfo(scgp, 0xAA, &l, NULL, NULL, NULL, NULL) >= 0) {
925 if (debug)
926 printf("lead out AA: %ld\n", l);
927 *lp = l;
928 } if (read_capacity(scgp) >= 0) {
929 l = scgp->cap->c_baddr + 1;
930 if (debug)
931 printf("lead out capacity: %ld\n", l);
932 } else {
933 succeed = FALSE;
934 }
935 *lp = l;
936 scgp->silent--;
937 return (succeed);
938 }
939
940 struct fwa {
941 char len;
942 char addr[4];
943 char res;
944 };
945
946 static int
947 first_writable_addr_philips(SCSI *scgp, long *ap, int track, int isaudio,
948 int preemp, int npa)
949 {
950 struct fwa fwa;
951 register struct scg_cmd *scmd = scgp->scmd;
952
953 fillbytes((caddr_t)&fwa, sizeof (fwa), '\0');
954 fillbytes((caddr_t)scmd, sizeof (*scmd), '\0');
955 scmd->addr = (caddr_t)&fwa;
956 scmd->size = sizeof (fwa);
957 scmd->flags = SCG_RECV_DATA|SCG_DISRE_ENA;
958 scmd->cdb_len = SC_G1_CDBLEN;
959 scmd->sense_len = CCS_SENSE_LEN;
960 scmd->cdb.g1_cdb.cmd = 0xE2;
961 scmd->cdb.g1_cdb.lun = scg_lun(scgp);
962 scmd->cdb.g1_cdb.addr[0] = track;
963 scmd->cdb.g1_cdb.addr[1] = isaudio ? (preemp ? 5 : 4) : 1;
964
965 scmd->cdb.g1_cdb.count[0] = npa?1:0;
966 scmd->cdb.g1_cdb.count[1] = sizeof (fwa);
967
968 scgp->cmdname = "first writeable address philips";
969
970 if (scg_cmd(scgp) < 0)
971 return (-1);
972
973 if (ap)
974 *ap = a_to_4_byte(fwa.addr);
975 return (0);
976 }
977
978 static int
979 next_wr_addr_philips(SCSI *scgp, track_t *trackp, long *ap)
980 {
981
982 /* if (first_writable_addr_philips(scgp, ap, 0, 0, 0, 1) < 0)*/
983 if (first_writable_addr_philips(scgp, ap, 0, 0, 0, 0) < 0)
984 return (-1);
985 return (0);
986 }
987
988 static int
989 reserve_track_philips(SCSI *scgp, unsigned long len)
990 {
991 register struct scg_cmd *scmd = scgp->scmd;
992
993 fillbytes((caddr_t)scmd, sizeof (*scmd), '\0');
994 scmd->flags = SCG_DISRE_ENA;
995 scmd->cdb_len = SC_G1_CDBLEN;
996 scmd->sense_len = CCS_SENSE_LEN;
997 scmd->cdb.g1_cdb.cmd = 0xE4;
998 scmd->cdb.g1_cdb.lun = scg_lun(scgp);
999 i_to_4_byte(&scmd->cdb.g1_cdb.addr[3], len);
1000
1001 scgp->cmdname = "philips reserve_track";
1002
1003 if (scg_cmd(scgp) < 0)
1004 return (-1);
1005 return (0);
1006 }
1007
1008 static int
1009 scsi_cdr_write_philips(SCSI *scgp,
1010 caddr_t bp /* address of buffer */,
1011 long sectaddr /* disk address (sector) to put */,
1012 long size /* number of bytes to transfer */,
1013 int blocks /* sector count */,
1014 BOOL islast /* last write for track */)
1015 {
1016 return (write_xg0(scgp, bp, 0, size, blocks));
1017 }
1018
1019 static int
1020 write_track_info_philips(SCSI *scgp, int sectype)
1021 {
1022 struct cdd_52x_mode_data md;
1023 int count = sizeof (struct scsi_mode_header) +
1024 sizeof (struct cdd_52x_mode_page_21);
1025
1026 fillbytes((caddr_t)&md, sizeof (md), '\0');
1027 md.pagex.page21.p_code = 0x21;
1028 md.pagex.page21.p_len = 0x0E;
1029 /* is sectype ok ??? */
1030 md.pagex.page21.sectype = sectype & ST_MASK;
1031 md.pagex.page21.track = 0; /* 0 : create new track */
1032
1033 return (mode_select(scgp, (Uchar *)&md, count, 0, scgp->inq->data_format >= 2));
1034 }
1035
1036 static int
1037 write_track_philips(SCSI *scgp,
1038 long track /* track number 0 == new track */,
1039 int sectype)
1040 {
1041 register struct scg_cmd *scmd = scgp->scmd;
1042
1043 fillbytes((caddr_t)scmd, sizeof (*scmd), '\0');
1044 scmd->flags = SCG_DISRE_ENA|SCG_CMD_RETRY;
1045 /* scmd->flags = SCG_DISRE_ENA;*/
1046 scmd->cdb_len = SC_G1_CDBLEN;
1047 scmd->sense_len = CCS_SENSE_LEN;
1048 scmd->cdb.g1_cdb.cmd = 0xE6;
1049 scmd->cdb.g1_cdb.lun = scg_lun(scgp);
1050 g1_cdbaddr(&scmd->cdb.g1_cdb, track);
1051 scmd->cdb.g1_cdb.res6 = sectype & ST_MASK;
1052
1053 scgp->cmdname = "philips write_track";
1054
1055 if (scg_cmd(scgp) < 0)
1056 return (-1);
1057 return (0);
1058 }
1059
1060 static int
1061 open_track_philips(SCSI *scgp, cdr_t *dp, track_t *trackp)
1062 {
1063 if (select_secsize(scgp, trackp->secsize) < 0)
1064 return (-1);
1065
1066 if (write_track_info_philips(scgp, trackp->sectype) < 0)
1067 return (-1);
1068
1069 if (write_track_philips(scgp, 0, trackp->sectype) < 0)
1070 return (-1);
1071
1072 return (0);
1073 }
1074
1075 static int
1076 open_track_plasmon(SCSI *scgp, cdr_t *dp, track_t *trackp)
1077 {
1078 if (select_secsize(scgp, trackp->secsize) < 0)
1079 return (-1);
1080
1081 if (write_track_info_philips(scgp, trackp->sectype) < 0)
1082 return (-1);
1083
1084 return (0);
1085 }
1086
1087 static int
1088 open_track_oldphilips(SCSI *scgp, cdr_t *dp, track_t *trackp)
1089 {
1090 if (write_track_philips(scgp, 0, trackp->sectype) < 0)
1091 return (-1);
1092
1093 return (0);
1094 }
1095
1096 static int
1097 open_track_yamaha(SCSI *scgp, cdr_t *dp, track_t *trackp)
1098 {
1099 if (select_secsize(scgp, trackp->secsize) < 0)
1100 return (-1);
1101
1102 if (write_track_philips(scgp, 0, trackp->sectype) < 0)
1103 return (-1);
1104
1105 return (0);
1106 }
1107
1108 static int
1109 close_track_philips(SCSI *scgp, cdr_t *dp, track_t *trackp)
1110 {
1111 return (scsi_flush_cache(scgp, FALSE));
1112 }
1113
1114 static int fixation_philips(SCSI *scgp, cdr_t *dp, track_t *trackp)
1115 {
1116 register struct scg_cmd *scmd = scgp->scmd;
1117
1118 fillbytes((caddr_t)scmd, sizeof (*scmd), '\0');
1119 scmd->flags = SCG_DISRE_ENA;
1120 scmd->cdb_len = SC_G1_CDBLEN;
1121 scmd->sense_len = CCS_SENSE_LEN;
1122 scmd->timeout = 8 * 60; /* Needs up to 4 minutes */
1123 scmd->cdb.g1_cdb.cmd = 0xE9;
1124 scmd->cdb.g1_cdb.lun = scg_lun(scgp);
1125 scmd->cdb.g1_cdb.count[1] =
1126 ((track_base(trackp)->tracktype & TOCF_MULTI) ? 8 : 0) |
1127 (track_base(trackp)->tracktype & TOC_MASK);
1128
1129 scgp->cmdname = "philips fixation";
1130
1131 if (scg_cmd(scgp) < 0)
1132 return (-1);
1133 return (0);
1134 }
1135
1136 static const char *sd_cdd_521_error_str[] = {
1137 "\003\000tray out", /* 0x03 */
1138 "\062\000write data error with CU", /* 0x32 */ /* Yamaha */
1139 "\063\000monitor atip error", /* 0x33 */
1140 "\064\000absorbtion control error", /* 0x34 */
1141 #ifdef YAMAHA_CDR_100
1142 /* Is this the same ??? */
1143 "\120\000write operation in progress", /* 0x50 */
1144 #endif
1145 "\127\000unable to read TOC/PMA/Subcode/ATIP", /* 0x57 */
1146 "\132\000operator medium removal request", /* 0x5a */
1147 "\145\000verify failed", /* 0x65 */
1148 "\201\000illegal track number", /* 0x81 */
1149 "\202\000command now not valid", /* 0x82 */
1150 "\203\000medium removal is prevented", /* 0x83 */
1151 "\204\000tray out", /* 0x84 */
1152 "\205\000track at one not in PMA", /* 0x85 */
1153 "\240\000stopped on non data block", /* 0xa0 */
1154 "\241\000invalid start adress", /* 0xa1 */
1155 "\242\000attampt to cross track-boundary", /* 0xa2 */
1156 "\243\000illegal medium", /* 0xa3 */
1157 "\244\000disk write protected", /* 0xa4 */
1158 "\245\000application code conflict", /* 0xa5 */
1159 "\246\000illegal blocksize for command", /* 0xa6 */
1160 "\247\000blocksize conflict", /* 0xa7 */
1161 "\250\000illegal transfer length", /* 0xa8 */
1162 "\251\000request for fixation failed", /* 0xa9 */
1163 "\252\000end of medium reached", /* 0xaa */
1164 #ifdef REAL_CDD_521
1165 "\253\000non reserved reserved track", /* 0xab */
1166 #else
1167 "\253\000illegal track number", /* 0xab */
1168 #endif
1169 "\254\000data track length error", /* 0xac */
1170 "\255\000buffer under run", /* 0xad */
1171 "\256\000illegal track mode", /* 0xae */
1172 "\257\000optical power calibration error", /* 0xaf */
1173 "\260\000calibration area almost full", /* 0xb0 */
1174 "\261\000current program area empty", /* 0xb1 */
1175 "\262\000no efm at search address", /* 0xb2 */
1176 "\263\000link area encountered", /* 0xb3 */
1177 "\264\000calibration area full", /* 0xb4 */
1178 "\265\000dummy data blocks added", /* 0xb5 */
1179 "\266\000block size format conflict", /* 0xb6 */
1180 "\267\000current command aborted", /* 0xb7 */
1181 "\270\000program area not empty", /* 0xb8 */
1182 #ifdef YAMAHA_CDR_100
1183 /* Used while writing lead in in DAO */
1184 "\270\000write leadin in progress", /* 0xb8 */
1185 #endif
1186 "\271\000parameter list too large", /* 0xb9 */
1187 "\277\000buffer overflow", /* 0xbf */ /* Yamaha */
1188 "\300\000no barcode available", /* 0xc0 */
1189 "\301\000barcode reading error", /* 0xc1 */
1190 "\320\000recovery needed", /* 0xd0 */
1191 "\321\000cannot recover track", /* 0xd1 */
1192 "\322\000cannot recover pma", /* 0xd2 */
1193 "\323\000cannot recover leadin", /* 0xd3 */
1194 "\324\000cannot recover leadout", /* 0xd4 */
1195 "\325\000cannot recover opc", /* 0xd5 */
1196 "\326\000eeprom failure", /* 0xd6 */
1197 "\340\000laser current over", /* 0xe0 */ /* Yamaha */
1198 "\341\000servo adjustment over", /* 0xe0 */ /* Yamaha */
1199 NULL
1200 };
1201
1202 static const char *sd_ro1420_error_str[] = {
1203 "\004\000logical unit is in process of becoming ready", /* 04 00 */
1204 "\011\200radial skating error", /* 09 80 */
1205 "\011\201sledge servo failure", /* 09 81 */
1206 "\011\202pll no lock", /* 09 82 */
1207 "\011\203servo off track", /* 09 83 */
1208 "\011\204atip sync error", /* 09 84 */
1209 "\011\205atip/subcode jumped error", /* 09 85 */
1210 "\127\300subcode not found", /* 57 C0 */
1211 "\127\301atip not found", /* 57 C1 */
1212 "\127\302no atip or subcode", /* 57 C2 */
1213 "\127\303pma error", /* 57 C3 */
1214 "\127\304toc read error", /* 57 C4 */
1215 "\127\305disk informatoion error", /* 57 C5 */
1216 "\144\200read in leadin", /* 64 80 */
1217 "\144\201read in leadout", /* 64 81 */
1218 "\201\000illegal track", /* 81 00 */
1219 "\202\000command not now valid", /* 82 00 */
1220 "\220\000reserve track check error", /* 90 00 */
1221 "\220\001verify blank error", /* 90 01 */
1222 "\221\001mode of last track error", /* 91 01 */
1223 "\222\000header search error", /* 92 00 */
1224 "\230\001header monitor error", /* 98 01 */
1225 "\230\002edc error", /* 98 02 */
1226 "\230\003read link, run-in run-out", /* 98 03 */
1227 "\230\004last one block error", /* 98 04 */
1228 "\230\005illegal blocksize", /* 98 05 */
1229 "\230\006not all data transferred", /* 98 06 */
1230 "\230\007cdbd over run error", /* 98 07 */
1231 "\240\000stopped on non_data block", /* A0 00 */
1232 "\241\000invalid start address", /* A1 00 */
1233 "\243\000illegal medium", /* A3 00 */
1234 "\246\000illegal blocksize for command", /* A6 00 */
1235 "\251\000request for fixation failed", /* A9 00 */
1236 "\252\000end of medium reached", /* AA 00 */
1237 "\253\000illegal track number", /* AB 00 */
1238 "\255\000buffer underrun", /* AD 00 */
1239 "\256\000illegal track mode", /* AE 00 */
1240 "\257\200power range error", /* AF 80 */
1241 "\257\201moderation error", /* AF 81 */
1242 "\257\202beta upper range error", /* AF 82 */
1243 "\257\203beta lower range error", /* AF 83 */
1244 "\257\204alpha upper range error", /* AF 84 */
1245 "\257\205alpha lower range error", /* AF 85 */
1246 "\257\206alpha and power range error", /* AF 86 */
1247 "\260\000calibration area almost full", /* B0 00 */
1248 "\261\000current program area empty", /* B1 00 */
1249 "\262\000no efm at search address", /* B2 00 */
1250 "\264\000calibration area full", /* B4 00 */
1251 "\265\000dummy blocks added", /* B5 00 */
1252 "\272\000write audio on reserved track", /* BA 00 */
1253 "\302\200syscon rom error", /* C2 80 */
1254 "\302\201syscon ram error", /* C2 81 */
1255 "\302\220efm encoder error", /* C2 90 */
1256 "\302\221efm decoder error", /* C2 91 */
1257 "\302\222servo ic error", /* C2 92 */
1258 "\302\223motor controller error", /* C2 93 */
1259 "\302\224dac error", /* C2 94 */
1260 "\302\225syscon eeprom error", /* C2 95 */
1261 "\302\240block decoder communication error", /* C2 A0 */
1262 "\302\241block encoder communication error", /* C2 A1 */
1263 "\302\242block encoder/decoder path error", /* C2 A2 */
1264 "\303\000CD-R engine selftest error", /* C3 xx */
1265 "\304\000buffer parity error", /* C4 00 */
1266 "\305\000data transfer error", /* C5 00 */
1267 "\340\00012V failure", /* E0 00 */
1268 "\341\000undefined syscon error", /* E1 00 */
1269 "\341\001syscon communication error", /* E1 01 */
1270 "\341\002unknown syscon error", /* E1 02 */
1271 "\342\000syscon not ready", /* E2 00 */
1272 "\343\000command rejected", /* E3 00 */
1273 "\344\000command not accepted", /* E4 00 */
1274 "\345\000verify error at beginning of track", /* E5 00 */
1275 "\345\001verify error at ending of track", /* E5 01 */
1276 "\345\002verify error at beginning of lead-in", /* E5 02 */
1277 "\345\003verify error at ending of lead-in", /* E5 03 */
1278 "\345\004verify error at beginning of lead-out", /* E5 04 */
1279 "\345\005verify error at ending of lead-out", /* E5 05 */
1280 "\377\000command phase timeout error", /* FF 00 */
1281 "\377\001data in phase timeout error", /* FF 01 */
1282 "\377\002data out phase timeout error", /* FF 02 */
1283 "\377\003status phase timeout error", /* FF 03 */
1284 "\377\004message in phase timeout error", /* FF 04 */
1285 "\377\005message out phase timeout error", /* FF 05 */
1286 NULL
1287 };
1288
1289 static int
1290 philips_attach(SCSI *scgp, cdr_t *dp)
1291 {
1292 scg_setnonstderrs(scgp, sd_cdd_521_error_str);
1293 return (0);
1294 }
1295
1296 static int
1297 plasmon_attach(SCSI *scgp, cdr_t *dp)
1298 {
1299 scgp->inq->data_format = 1; /* Correct the ly */
1300
1301 scg_setnonstderrs(scgp, sd_cdd_521_error_str);
1302 return (0);
1303 }
1304
1305 static int
1306 ricoh_attach(SCSI *scgp, cdr_t *dp)
1307 {
1308 if (dp == &cdr_ricoh_ro1060) {
1309 errmsgno(EX_BAD, "No support for Ricoh RO-1060C\n");
1310 return (-1);
1311 }
1312 scg_setnonstderrs(scgp, sd_ro1420_error_str);
1313 return (0);
1314 }
1315
1316 static int
1317 philips_getlilo(SCSI *scgp, long *lilenp, long *lolenp)
1318 {
1319 char buf[4];
1320 long li, lo;
1321 register struct scg_cmd *scmd = scgp->scmd;
1322
1323 fillbytes((caddr_t)scmd, sizeof (*scmd), '\0');
1324 scmd->addr = buf;
1325 scmd->size = sizeof (buf);
1326 scmd->flags = SCG_RECV_DATA|SCG_DISRE_ENA;
1327 scmd->cdb_len = SC_G1_CDBLEN;
1328 scmd->sense_len = CCS_SENSE_LEN;
1329 scmd->cdb.g1_cdb.cmd = 0xEE; /* Read session info */
1330 scmd->cdb.g1_cdb.lun = scg_lun(scgp);
1331 g1_cdblen(&scmd->cdb.g1_cdb, sizeof (buf));
1332
1333 scgp->cmdname = "philips read session info";
1334
1335 if (scg_cmd(scgp) < 0)
1336 return (-1);
1337
1338 if (scgp->verbose)
1339 scg_prbytes("Session info data: ", (Uchar *)buf, sizeof (buf) - scg_getresid(scgp));
1340
1341 li = a_to_u_2_byte(buf);
1342 lo = a_to_u_2_byte(&buf[2]);
1343
1344 if (lilenp)
1345 *lilenp = li;
1346 if (lolenp)
1347 *lolenp = lo;
1348
1349 return (0);
1350 }

  ViewVC Help
Powered by ViewVC 1.1.5