;;; -*- Mode: Common-Lisp; Package: User; Base: 10.; Patch-File: T -*-

;;; Reason: Increase the micronet port handler's priority.  LER   06/12/89

;;;                           RESTRICTED RIGHTS LEGEND
;;;
;;; Use, duplication, or disclosure by the Government is subject to
;;; restrictions as set forth in subdivision (c)(1)(ii) of the Rights in
;;; Technical Data and Computer Software clause at 52.227-7013.
;;;
;;;   TEXAS INSTRUMENTS INCORPORATED      
;;;   P.O. BOX 2909, M/S 2151             
;;;   AUSTIN, TEXAS 78769                 
;;;
;;; Copyright (C) 1989 Texas Instruments Incorporated.
;;; All rights reserved.

;;; Written 06/12/89 11:34:12 by reiner,
;;; while running on MX30 from band DEC 
;;; With SYSTEM 6.2, GC 6.0, VIRTUAL-MEMORY 6.0, MICRONET 6.0, MICRONET-COMM 6.0,
;;;  DISK-IO 6.0, DISK-LABEL 6.0, BASIC-PATHNAME 6.0, MAC-PATHNAME 6.0, NETWORK-SUPPORT-COLD 6.0,
;;;  BASIC-NAMESPACE 6.0, BASIC-FILE 6.0, RPC 6.0, NFS 6.0, EH 6.0, MAKE-SYSTEM 6.0,
;;;  MEMORY-AUX 6.0, COMPILER 6.1, TV 6.6, NVRAM 6.0, UCL 6.0, INPUT-EDITOR 6.0, MACTOOLBOX 2.0,
;;;  METER 6.0, ZWEI 6.0, DEBUG-TOOLS 6.0, WINDOW-MX 6.0, PRINTER 6.0, MAC-PRINTER-TYPES 6.0,
;;;  CLIPBOARD 6.0, NETWORK-PATHNAME 6.0, NETWORK-NAMESPACE 6.0, DATALINK 6.0, CHAOSNET 6.0,
;;;  NETWORK-SUPPORT 6.0, NETWORK-SERVICE 6.0, DATALINK-DISPLAYS 6.0, Inconsistent MX-DATALINK 6.1,
;;;  NAMESPACE-EDITOR 6.0, IP 3.42, NFS-SERVER 6.0, MX-SERIAL 6.0, PRINTER-TYPES 6.0,
;;;  IMAGEN 6.0, MAIL-DAEMON 6.2, MAIL-READER 6.0, TELNET 6.0, VT100 6.0, STREAMER-TAPE 6.0,
;;;  DECNET 1.65, VISIDOC 6.0, PROFILE 6.1, TI-CLOS 6.3, CLEH 6.0, CLX 6.0, CLUE 6.0,
;;;  Experimental BUG 11.5,  microcode 138, Band Name: Release 6.0 mx 5/26

#!C
; From file MICRONET-PORTS.LISP#> MICRONET; SYS:
#10R MICRONET#:
(COMPILER-LET ((*PACKAGE* (FIND-PACKAGE "MICRONET"))
                          (SI:*LISP-MODE* :COMMON-LISP)
                          (*READTABLE* COMMON-LISP-READTABLE)
                          (SI:*READER-SYMBOL-SUBSTITUTIONS* SYS::*COMMON-LISP-SYMBOL-SUBSTITUTIONS*))
  (COMPILER#:PATCH-SOURCE-FILE "SYS: MICRONET; MICRONET-PORTS.#"


(defun MICRONET-RESET (&optional (enable-p net:*net-reset-enable-p*))
  (when (typep *micronet-port-handler-process* 'si:process)
    (send *micronet-port-handler-process* :kill t)
    (setf *micronet-port-handler-process* nil))

  (initialize-micronet-ports)
  (cond (enable-p
	 (setf *micronet-port-handler* (make-instance 'micronet-port-handler))
	 (setf *micronet-port-handler-process*
	       (process-run-function
		 '(:name "Micronet port handler"
			 :priority 28
			 :restart-after-reset t
			 :restart-after-boot t)
		 #'(lambda () (loop (send *micronet-port-handler* :receive))))))
	(t	 
	 (setf *micronet-port-handler*
	       #'(lambda (operation &rest ignore)
		   (CASE operation
		     (:receive-data nil)
		     (otherwise
		      (FERROR 'micronet-error "Micronet Service is not enabled."))))))))

))
