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