SCCS-vsn: sys/vax/uba/rx.c 4.16
-/* rx.c 4.15 83/04/15 */
+/* rx.c 4.16 83/04/26 */
#include "rx.h"
#if NFX > 0
#include "rx.h"
#if NFX > 0
/* per-drive data */
struct rx_softc {
int sc_flags; /* drive status flags */
/* per-drive data */
struct rx_softc {
int sc_flags; /* drive status flags */
-#define RXF_TRKZERO 0x01 /* start mapping on track 0 */
-#define RXF_DIRECT 0x02 /* use direct sector mapping */
+#define RXF_DIRECT 0x01 /* if set: use direct sector mapping */
+#define RXF_TRKONE 0x02 /* if set: start mapping on track 1 */
#define RXF_DBLDEN 0x04 /* use double density */
#define RXF_DEVTYPE 0x07 /* mapping flags */
#define RXF_LOCK 0x10 /* exclusive use */
#define RXF_DBLDEN 0x04 /* use double density */
#define RXF_DEVTYPE 0x07 /* mapping flags */
#define RXF_LOCK 0x10 /* exclusive use */
/*ARGSUSED1*/
rxopen(dev, flag)
dev_t dev;
/*ARGSUSED1*/
rxopen(dev, flag)
dev_t dev;
{
register int unit = RXUNIT(dev);
register struct rx_softc *sc;
{
register int unit = RXUNIT(dev);
register struct rx_softc *sc;
* lock the device while an open
* is in progress
*/
* lock the device while an open
* is in progress
*/
- sc->sc_flags = (minor(dev) & RXF_DEVTYPE) || RXF_LOCK;
+ sc->sc_flags = (minor(dev) & RXF_DEVTYPE) | RXF_LOCK;
sc->sc_csbits = RX_INTR;
sc->sc_csbits |= ui->ui_slave == 0 ? RX_DRV0 : RX_DRV1;
sc->sc_csbits = RX_INTR;
sc->sc_csbits |= ui->ui_slave == 0 ? RX_DRV0 : RX_DRV1;
if (rxwstart++ == 0) {
rxc = &rx_ctlr[ui->ui_mi->um_ctlr];
rxc->rxc_tocnt = 0;
if (rxwstart++ == 0) {
rxc = &rx_ctlr[ui->ui_mi->um_ctlr];
rxc->rxc_tocnt = 0;
- timeout(rxtimo(), (caddr_t)0, hz); /* start watchdog */
+ timeout(rxwatch, (caddr_t)0, hz); /* start watchdog */
}
#ifdef RXDEBUG
printf("rxopen: csbits=0x%x\n", sc->sc_csbits);
}
#ifdef RXDEBUG
printf("rxopen: csbits=0x%x\n", sc->sc_csbits);
/*ARGSUSED1*/
rxclose(dev, flag)
dev_t dev;
/*ARGSUSED1*/
rxclose(dev, flag)
dev_t dev;
{
register struct rx_softc *sc = &rx_softc[RXUNIT(dev)];
--sc->sc_open;
{
register struct rx_softc *sc = &rx_softc[RXUNIT(dev)];
--sc->sc_open;
printf("rxclose: dev=0x%x, sc_open=%d\n", dev, sc->sc_open);
printf("rxclose: dev=0x%x, sc_open=%d\n", dev, sc->sc_open);
ptoff = 0;
if (sc->sc_flags & RXF_DIRECT)
ptoff = 77;
ptoff = 0;
if (sc->sc_flags & RXF_DIRECT)
ptoff = 77;
- if (sc->sc_flags & RXF_TRKZERO)
+ if (sc->sc_flags & RXF_TRKONE)
ptoff++;
if (lt + ptoff < 77)
ls = ((ls << 1) + (ls >= 13) + (6*lt)) % 26;
ptoff++;
if (lt + ptoff < 77)
ls = ((ls << 1) + (ls >= 13) + (6*lt)) % 26;
goto rdone;
case RXS_RDERR:
goto rdone;
case RXS_RDERR:
- bp = bp->b_back; /* kludge, see 'rderr:' */
rxmap(bp, §or, &track);
printf("rx%d: hard error, trk %d psec %d ",
unit, track, sector);
printf("cs=%b, db=%b, err=", MASKREG(er->rxcs),
RXCS_BITS, MASKREG(er->rxdb), RXES_BITS);
rxmap(bp, §or, &track);
printf("rx%d: hard error, trk %d psec %d ",
unit, track, sector);
printf("cs=%b, db=%b, err=", MASKREG(er->rxcs),
RXCS_BITS, MASKREG(er->rxdb), RXES_BITS);
- printf("0x%x, 0x%x, 0x%x, 0x%x\n", MASKREG(er->rxxt[0]),
+ printf("%x, %x, %x, %x\n", MASKREG(er->rxxt[0]),
MASKREG(er->rxxt[1]), MASKREG(er->rxxt[2]),
MASKREG(er->rxxt[3]));
goto done;
MASKREG(er->rxxt[1]), MASKREG(er->rxxt[2]),
MASKREG(er->rxxt[3]));
goto done;
{
register struct uba_device *ui;
register struct uba_ctlr *um;
{
register struct uba_device *ui;
register struct uba_ctlr *um;
for (i=0; i<NRX; i++) {
ui = rxdinfo[i];
for (i=0; i<NRX; i++) {
ui = rxdinfo[i];
- sc = &rx_softc[i];
- um = ui->ui_mi;
if (ui == 0 || ui->ui_alive == 0)
continue;
if (ui == 0 || ui->ui_alive == 0)
continue;
- if ((sc->sc_open == 0) && (um->um_tab.b_active == 0)) {
+ sc = &rx_softc[i];
+ if ((sc->sc_open == 0) && (rxutab[i].b_active == 0)) {
sc->sc_csbits = 0;
continue;
}
dopen++;
sc->sc_csbits = 0;
continue;
}
dopen++;
rxc = &rx_ctlr[um->um_ctlr];
rxc = &rx_ctlr[um->um_ctlr];
- if (++rxc->rxc_tocnt < RX_MAXTIMEOUT) {
- printf("fx%d: timeout\n", um->um_ctlr);
- rxintr(um->um_ctlr);
+ if (++rxc->rxc_tocnt >= RX_MAXTIMEOUT) {
+ rxc->rxc_tocnt = 0;
+ if (um->um_tab.b_active) {
+ printf("rx%d: timeout\n", i);/* for debugging */
+ rxintr(um->um_ctlr);
+ }
- timeout(rxtimo(), (caddr_t)0, hz);
+ timeout(rxwatch, (caddr_t)0, hz);
- * processes three kinds of requests:
+ * processes four kinds of requests:
*
* (1) Set density (i.e., format the diskette) according to
*
* (1) Set density (i.e., format the diskette) according to
- * that specified by the open device.
+ * that specified data parameter
* (2) Arrange for the next sector to be written with a deleted-
* data mark.
* (3) Report whether the last sector read had a deleted-data mark
* (2) Arrange for the next sector to be written with a deleted-
* data mark.
* (3) Report whether the last sector read had a deleted-data mark
+ * (4) Report the density of the diskette in the indicated drive
+ * (since the density it automatically determined by the driver,
+ * this is the only way to let an application program know the
+ * density)
*
* Requests relating to deleted-data marks can be handled right here.
* A "set density" (format) request, however, must additionally be
* processed through "rxstart", just like a read or write request.
*/
*
* Requests relating to deleted-data marks can be handled right here.
* A "set density" (format) request, however, must additionally be
* processed through "rxstart", just like a read or write request.
*/
/*ARGSUSED3*/
rxioctl(dev, cmd, data, flag)
dev_t dev;
/*ARGSUSED3*/
rxioctl(dev, cmd, data, flag)
dev_t dev;
{
int unit = RXUNIT(dev);
struct rx_softc *sc = &rx_softc[unit];
{
int unit = RXUNIT(dev);
struct rx_softc *sc = &rx_softc[unit];
+ switch (cmd&RXIOC_MASK) {
+#ifdef notdef /* temporarily removed (the flag argument is */
+ /* is actually always zero at this point) */
if ((flag&FWRITE) == 0)
return (EBADF);
if ((flag&FWRITE) == 0)
return (EBADF);
sc->sc_csbits |= *(int *)data ? RX_DDEN : RX_SDEN;
return (rxformat(dev));
sc->sc_csbits |= *(int *)data ? RX_DDEN : RX_SDEN;
return (rxformat(dev));