home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $Header: SRC:CVSROOT/Vector/ParNet/unit_ctl.c,v 1.1.1.1 1994/06/23 02:39:42 Barnard Exp $
- */
-
- /*
- ** This code was originally written by Matthew Dillon and put into Public Domain
- **
- ** All changes concerning the adaption of Matt's original code to the
- ** Vector Connection I/O board are © 1991-1994 by Henning Schmiedehausen
- ** All rights for this changes are reserved. The original code is Public Domain
- **
- ** This code is distributed with the expressed written permission of Matthew
- ** Dillon (Thank you very much, Matt)
- **
- */
-
- /*
- * UNIT_CTL.C
- *
- * Control Unit. Used for global control, sink null as far as
- * read & write goes.
- */
-
- #include "defs.h"
-
- #include "unit_ctl_protos.h"
- #include "parnet_protos.h"
- #include "task_protos.h"
-
- #include <proto/exec.h>
- #include <stdlib.h>
- #include <stddef.h>
- #include <string.h>
-
- #include "parnet_asm.h"
-
- void CtlBeginIO();
- void CtlAbortIO();
- void CtlClose();
- void CtlData();
-
- static short CtlRefs = 0;
-
- void
- UnitControlOpen(iob, unitnum, flags)
- Iob *iob;
- long unitnum;
- long flags;
- {
- Unit *unit = AllocUnit(iob, CtlBeginIO, CtlAbortIO, CtlData, CtlClose);
-
- ++CtlRefs;
-
- iob->io_Unit = unit;
- iob->io_Port = 0;
- iob->io_Addr = 0;
- }
-
- void
- CtlData(cmd, unit, packet)
- Unit *unit;
- Packet *packet;
- {
- FreeParPacket(packet);
- }
-
-
- void
- CtlClose(iob)
- Iob *iob;
- {
- FreeUnit(iob->io_Unit);
-
- --CtlRefs;
-
- iob->io_Unit = NULL;
- }
-
- void
- CtlBeginIO(iob)
- Iob *iob;
- {
- iob->io_Error = 0;
- iob->io_Actual = 0;
- iob->io_Message.mn_Node.ln_Type = NT_MESSAGE;
-
- switch(iob->io_Command) {
- case PPD_SETADDR: /* set network address */
- ParAddress(iob->io_Addr);
- DevBase->ParAddress = iob->io_Addr;
- WriteConfig();
- break;
- case PPD_SETTO: /* set network timeout */
- ParLLTimeout = iob->io_Offset;
- WriteConfig();
- break;
- default:
- iob->io_Error = IOERR_NOCMD;
- break;
- }
- if ((iob->io_Flags & IOF_QUICK) == 0)
- ReplyMsg(&iob->io_Message);
- }
-
- void
- CtlAbortIO(iob)
- Iob *iob;
- {
- }
-
-