fdc.c (e34c71ea40a1a18d241a5459d22765bffe3eb719) fdc.c (6fb89845b4b67741667ef36b4eda9c5125014676)
1/*
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Don Ahn.
7 *
8 * Libretto PCMCIA floppy support by David Horwitt (dhorwitt@ucsd.edu)

--- 92 unchanged lines hidden (view full) ---

101/* internally used only, not really from CMOS: */
102#define RTCFDT_144M_PRETENDED 0x1000
103
104/* error returns for fd_cmd() */
105#define FD_FAILED -1
106#define FD_NOT_VALID -2
107#define FDC_ERRMAX 100 /* do not log more */
108
1/*
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Don Ahn.
7 *
8 * Libretto PCMCIA floppy support by David Horwitt (dhorwitt@ucsd.edu)

--- 92 unchanged lines hidden (view full) ---

101/* internally used only, not really from CMOS: */
102#define RTCFDT_144M_PRETENDED 0x1000
103
104/* error returns for fd_cmd() */
105#define FD_FAILED -1
106#define FD_NOT_VALID -2
107#define FDC_ERRMAX 100 /* do not log more */
108
109#define NUMTYPES 14
110#define NUMDENS (NUMTYPES - 6)
109#define NUMTYPES 17
110#define NUMDENS (NUMTYPES - 7)
111
112/* These defines (-1) must match index for fd_types */
113#define F_TAPE_TYPE 0x020 /* bit for fd_types to indicate tape */
114#define NO_TYPE 0 /* must match NO_TYPE in ft.c */
115#define FD_1720 1
116#define FD_1480 2
117#define FD_1440 3
118#define FD_1200 4
119#define FD_820 5
120#define FD_800 6
121#define FD_720 7
122#define FD_360 8
111
112/* These defines (-1) must match index for fd_types */
113#define F_TAPE_TYPE 0x020 /* bit for fd_types to indicate tape */
114#define NO_TYPE 0 /* must match NO_TYPE in ft.c */
115#define FD_1720 1
116#define FD_1480 2
117#define FD_1440 3
118#define FD_1200 4
119#define FD_820 5
120#define FD_800 6
121#define FD_720 7
122#define FD_360 8
123#define FD_640 9
124#define FD_1232 10
123
125
124#define FD_1480in5_25 9
125#define FD_1440in5_25 10
126#define FD_820in5_25 11
127#define FD_800in5_25 12
128#define FD_720in5_25 13
129#define FD_360in5_25 14
126#define FD_1480in5_25 11
127#define FD_1440in5_25 12
128#define FD_820in5_25 13
129#define FD_800in5_25 14
130#define FD_720in5_25 15
131#define FD_360in5_25 16
132#define FD_640in5_25 17
130
131
132static struct fd_type fd_types[NUMTYPES] =
133{
134{ 21,2,0xFF,0x04,82,3444,1,FDC_500KBPS,2,0x0C,2 }, /* 1.72M in HD 3.5in */
135{ 18,2,0xFF,0x1B,82,2952,1,FDC_500KBPS,2,0x6C,1 }, /* 1.48M in HD 3.5in */
136{ 18,2,0xFF,0x1B,80,2880,1,FDC_500KBPS,2,0x6C,1 }, /* 1.44M in HD 3.5in */
137{ 15,2,0xFF,0x1B,80,2400,1,FDC_500KBPS,2,0x54,1 }, /* 1.2M in HD 5.25/3.5 */
138{ 10,2,0xFF,0x10,82,1640,1,FDC_250KBPS,2,0x2E,1 }, /* 820K in HD 3.5in */
139{ 10,2,0xFF,0x10,80,1600,1,FDC_250KBPS,2,0x2E,1 }, /* 800K in HD 3.5in */
140{ 9,2,0xFF,0x20,80,1440,1,FDC_250KBPS,2,0x50,1 }, /* 720K in HD 3.5in */
141{ 9,2,0xFF,0x2A,40, 720,1,FDC_250KBPS,2,0x50,1 }, /* 360K in DD 5.25in */
133
134
135static struct fd_type fd_types[NUMTYPES] =
136{
137{ 21,2,0xFF,0x04,82,3444,1,FDC_500KBPS,2,0x0C,2 }, /* 1.72M in HD 3.5in */
138{ 18,2,0xFF,0x1B,82,2952,1,FDC_500KBPS,2,0x6C,1 }, /* 1.48M in HD 3.5in */
139{ 18,2,0xFF,0x1B,80,2880,1,FDC_500KBPS,2,0x6C,1 }, /* 1.44M in HD 3.5in */
140{ 15,2,0xFF,0x1B,80,2400,1,FDC_500KBPS,2,0x54,1 }, /* 1.2M in HD 5.25/3.5 */
141{ 10,2,0xFF,0x10,82,1640,1,FDC_250KBPS,2,0x2E,1 }, /* 820K in HD 3.5in */
142{ 10,2,0xFF,0x10,80,1600,1,FDC_250KBPS,2,0x2E,1 }, /* 800K in HD 3.5in */
143{ 9,2,0xFF,0x20,80,1440,1,FDC_250KBPS,2,0x50,1 }, /* 720K in HD 3.5in */
144{ 9,2,0xFF,0x2A,40, 720,1,FDC_250KBPS,2,0x50,1 }, /* 360K in DD 5.25in */
145{ 8,2,0xFF,0x2A,80,1280,1,FDC_250KBPS,2,0x50,1 }, /* 640K in DD 5.25in */
146{ 8,3,0xFF,0x35,77,1232,1,FDC_500KBPS,2,0x74,1 }, /* 1.23M in HD 5.25in */
142
143{ 18,2,0xFF,0x02,82,2952,1,FDC_500KBPS,2,0x02,2 }, /* 1.48M in HD 5.25in */
144{ 18,2,0xFF,0x02,80,2880,1,FDC_500KBPS,2,0x02,2 }, /* 1.44M in HD 5.25in */
145{ 10,2,0xFF,0x10,82,1640,1,FDC_300KBPS,2,0x2E,1 }, /* 820K in HD 5.25in */
146{ 10,2,0xFF,0x10,80,1600,1,FDC_300KBPS,2,0x2E,1 }, /* 800K in HD 5.25in */
147{ 9,2,0xFF,0x20,80,1440,1,FDC_300KBPS,2,0x50,1 }, /* 720K in HD 5.25in */
148{ 9,2,0xFF,0x23,40, 720,2,FDC_300KBPS,2,0x50,1 }, /* 360K in HD 5.25in */
147
148{ 18,2,0xFF,0x02,82,2952,1,FDC_500KBPS,2,0x02,2 }, /* 1.48M in HD 5.25in */
149{ 18,2,0xFF,0x02,80,2880,1,FDC_500KBPS,2,0x02,2 }, /* 1.44M in HD 5.25in */
150{ 10,2,0xFF,0x10,82,1640,1,FDC_300KBPS,2,0x2E,1 }, /* 820K in HD 5.25in */
151{ 10,2,0xFF,0x10,80,1600,1,FDC_300KBPS,2,0x2E,1 }, /* 800K in HD 5.25in */
152{ 9,2,0xFF,0x20,80,1440,1,FDC_300KBPS,2,0x50,1 }, /* 720K in HD 5.25in */
153{ 9,2,0xFF,0x23,40, 720,2,FDC_300KBPS,2,0x50,1 }, /* 360K in HD 5.25in */
154{ 8,2,0xFF,0x2A,80,1280,1,FDC_300KBPS,2,0x50,1 }, /* 640K in HD 5.25in */
149};
150
151#define DRVS_PER_CTLR 2 /* 2 floppies */
152
153/***********************************************************************\
154* Per controller structure. *
155\***********************************************************************/
156static devclass_t fdc_devclass;

--- 1215 unchanged lines hidden (view full) ---

1372 */
1373 if (type != fd->type) {
1374 switch (fd->type) {
1375 case FD_360:
1376 return (ENXIO);
1377 case FD_720:
1378 if ( type != FD_820
1379 && type != FD_800
155};
156
157#define DRVS_PER_CTLR 2 /* 2 floppies */
158
159/***********************************************************************\
160* Per controller structure. *
161\***********************************************************************/
162static devclass_t fdc_devclass;

--- 1215 unchanged lines hidden (view full) ---

1378 */
1379 if (type != fd->type) {
1380 switch (fd->type) {
1381 case FD_360:
1382 return (ENXIO);
1383 case FD_720:
1384 if ( type != FD_820
1385 && type != FD_800
1386 && type != FD_640
1380 )
1381 return (ENXIO);
1382 break;
1383 case FD_1200:
1384 switch (type) {
1385 case FD_1480:
1386 type = FD_1480in5_25;
1387 break;
1388 case FD_1440:
1389 type = FD_1440in5_25;
1390 break;
1387 )
1388 return (ENXIO);
1389 break;
1390 case FD_1200:
1391 switch (type) {
1392 case FD_1480:
1393 type = FD_1480in5_25;
1394 break;
1395 case FD_1440:
1396 type = FD_1440in5_25;
1397 break;
1398 case FD_1232:
1399 break;
1391 case FD_820:
1392 type = FD_820in5_25;
1393 break;
1394 case FD_800:
1395 type = FD_800in5_25;
1396 break;
1397 case FD_720:
1398 type = FD_720in5_25;
1399 break;
1400 case FD_820:
1401 type = FD_820in5_25;
1402 break;
1403 case FD_800:
1404 type = FD_800in5_25;
1405 break;
1406 case FD_720:
1407 type = FD_720in5_25;
1408 break;
1409 case FD_640:
1410 type = FD_640in5_25;
1411 break;
1400 case FD_360:
1401 type = FD_360in5_25;
1402 break;
1403 default:
1404 return(ENXIO);
1405 }
1406 break;
1407 case FD_1440:
1408 if ( type != FD_1720
1409 && type != FD_1480
1410 && type != FD_1200
1411 && type != FD_820
1412 && type != FD_800
1413 && type != FD_720
1412 case FD_360:
1413 type = FD_360in5_25;
1414 break;
1415 default:
1416 return(ENXIO);
1417 }
1418 break;
1419 case FD_1440:
1420 if ( type != FD_1720
1421 && type != FD_1480
1422 && type != FD_1200
1423 && type != FD_820
1424 && type != FD_800
1425 && type != FD_720
1426 && type != FD_640
1414 )
1415 return(ENXIO);
1416 break;
1417 }
1418 }
1419 }
1420 fd->ft = fd_types + type - 1;
1421 fd->flags |= FD_OPEN;

--- 956 unchanged lines hidden ---
1427 )
1428 return(ENXIO);
1429 break;
1430 }
1431 }
1432 }
1433 fd->ft = fd_types + type - 1;
1434 fd->flags |= FD_OPEN;

--- 956 unchanged lines hidden ---