[4492] in Athena Bugs

home help back first fref pref prev next nref lref last post

Fix so modem port on the PVAX works.

daemon@ATHENA.MIT.EDU (jis@MIT.EDU)
Sun Mar 11 02:48:49 1990

From: jis@MIT.EDU
Date: Sun, 11 Mar 90 02:48:21 -0500
To: bugs@MIT.EDU
	The following patch will allow the modem port on the PVAX to
function. The patch should be applied to /source/bsd-4.3/vax/sys/vaxuba/ss.c.

			-Jeff

Begin Enclosed Patch:
*** ss.c.ori	Sat Oct 28 07:05:54 1989
--- ss.c	Sat Mar 10 23:29:04 1990
***************
*** 38,43 ****
--- 38,47 ----
   *
   *  Modification History:
   *
+  * 10-Mar-90 - jis (Jeff Schiller)
+  *      Add support for the PVAX. Specifically CD and CTS doesn't exist
+  *      so just look at DSR. Borrowed from latest Ultrix 3.1 device driver.
+  *
   * 11-Feb-87 - rafiey (Ali Rafieymehr)
   *	Changed the driver to call read/write routines of the color driver
   *	for reads/writes.
***************
*** 358,369 ****
  			 if ((ssaddr->ssmsr)&SS_RDSR) {
  				ssmodem |= (MODEM_DSR_START|MODEM_DSR);
  				tp->t_dev = dev; /* need it for timeouts */
! 				/* 
! 		 		* Give Carrier and CTS 30 sec. to come up.  
! 		 		* Prevent any transmission in the first 500ms.
! 		 		*/
! 				timeout(ss_dsr_check, tp, hz*30);  
! 				timeout(ss_dsr_check, tp, hz/2);
  			}
  		}
  		/* 
--- 362,383 ----
  			 if ((ssaddr->ssmsr)&SS_RDSR) {
  				ssmodem |= (MODEM_DSR_START|MODEM_DSR);
  				tp->t_dev = dev; /* need it for timeouts */
! 				if (!ss_modem_ctl) {
! 				  /*
! 				   * Assume carrier will come up in less
! 				   * than 1 sec. If not DSR will drop
! 				   * and the line will close.
! 				   */
! 				  timeout(ss_dsr_check, tp, hz);
! 				} else {
! 				  /* 
! 				   * Give Carrier and CTS 30 sec. to come up.  
! 				   * Prevent any transmission
! 				   * in the first 500ms.
! 				   */
! 				  timeout(ss_dsr_check, tp, hz*30);  
! 				  timeout(ss_dsr_check, tp, hz/2);
! 			      }
  			}
  		}
  		/* 
***************
*** 822,828 ****
  	    	 * for CD|CTS only.
  	    	 */
  		if ((ssdsr && ((ssaddr->ssmsr&SS_XMIT) == SS_XMIT)) ||
! 		   ((ssdsr==0) && ((ssaddr->ssmsr&SS_NODSR) == SS_NODSR))) {
  			tp->t_state &= ~(TS_ONDELAY);
  			tp->t_state |= TS_CARR_ON;
  			ssmodem = MODEM_CTS|MODEM_CD|MODEM_DSR;
--- 836,843 ----
  	    	 * for CD|CTS only.
  	    	 */
  		if ((ssdsr && ((ssaddr->ssmsr&SS_XMIT) == SS_XMIT)) ||
! 		   ((ssdsr==0) && ((ssaddr->ssmsr&SS_NODSR) == SS_NODSR)) ||
! 		    ((!ss_modem_ctl) && (ssaddr->ssmsr&SS_RDSR))) {
  			tp->t_state &= ~(TS_ONDELAY);
  			tp->t_state |= TS_CARR_ON;
  			ssmodem = MODEM_CTS|MODEM_CD|MODEM_DSR;
***************
*** 845,851 ****
  	    	 * for CD|CTS only.
  	    	 */
  		if ((ssdsr && ((ssaddr->ssmsr&SS_XMIT) == SS_XMIT)) ||
! 		   ((ssdsr==0) && ((ssaddr->ssmsr&SS_NODSR) == SS_NODSR))) {
  			tp->t_state |= TS_CARR_ON;
  			tp->t_state &= ~(TS_ONDELAY);
  			ssmodem = MODEM_CTS|MODEM_CD|MODEM_DSR;
--- 860,867 ----
  	    	 * for CD|CTS only.
  	    	 */
  		if ((ssdsr && ((ssaddr->ssmsr&SS_XMIT) == SS_XMIT)) ||
! 		   ((ssdsr==0) && ((ssaddr->ssmsr&SS_NODSR) == SS_NODSR)) ||
! 		    ((!ss_modem_ctl) && (ssaddr->ssmsr&SSRDSR))) {
  			tp->t_state |= TS_CARR_ON;
  			tp->t_state &= ~(TS_ONDELAY);
  			ssmodem = MODEM_CTS|MODEM_CD|MODEM_DSR;
***************
*** 1238,1330 ****
  				 	* we should not look for CTS|CD for
  				 	* about 500 ms.  
  				 	*/
! 					timeout(ss_dsr_check, tp, hz*30);
! 					timeout(ss_dsr_check, tp, hz/2);
  			    	}
  			}
  			/*
  			 * Look for modem transitions in an already established
  			 * connection.
  			 */
! 			if (tp->t_state & TS_CARR_ON) {
  				if (ssaddr->ssmsr&SS_RCD) {
! 					/*
! 					 * CD has come up again.
! 					 * Stop timeout from occurring if set.
! 					 * If interval is more than 2 secs then
! 					 *  drop DTR.
! 					 */
! 					if ((ssmodem&MODEM_CD)==0) { 
! 						untimeout(ss_cd_drop, tp);
! 						if (ss_cd_down(tp)){
! 							/* drop connection */
! 							ss_tty_drop(tp);
! 						}
! 						ssmodem |= MODEM_CD;
  					}
  				}
  				else {
  					/* 
! 					 * Carrier must be down for greater than 2 secs
! 					 * before closing down the line.
  					 */
! 					if ( ssmodem & MODEM_CD) {
! 					    /* only start timer once */
! 					    ssmodem &= ~MODEM_CD;
! 					    /* 
! 					     * Record present time so that if carrier
! 					     * comes up after 2 secs , the line will drop.
! 					     */
! 					    sstimestamp = time;
! 					    timeout(ss_cd_drop, tp, hz*2);
! 					}
  				}
  				/* CTS flow control check */
! 		
  				if (!(ssaddr->ssmsr&SS_RCTS)) {
! 					/* 
! 					 * Only allow transmission when CTS is set.
! 					 */
! 					tp->t_state |= TS_TTSTOP;
! 					ssmodem &= ~MODEM_CTS;
! #					ifdef DEBUG
! 					if (ssdebug)
! 					   log(LOG_WARNING,"ssscan: CTS stop, tp=%x,line=%d\n", tp,i);
! #					endif DEBUG
! 					ssstop(tp, 0);
  				} else if ((ssmodem&MODEM_CTS)==0) { 
! 					    /* 
! 					     * Restart transmission upon return of CTS.
! 					     */
! 					    tp->t_state &= ~TS_TTSTOP;
! 					    ssmodem |= MODEM_CTS;
  #					    ifdef DEBUG
! 					    if (ssdebug)
! 					       log(LOG_WARNING,"ssscan: CTS start, tp=%x,line=%d\n", tp,i);
  #					    endif DEBUG
! 					    ssstart(tp);
  				}
! 	
! 	
! 			} 
! 			
! 			/* 
! 			 * See if a modem transition has occured.  If we are waiting
! 			 * for this signal cause action to be taken via ss_tty_start.
! 			 */
! 			 if ((sscan_modem=ssaddr->ssmsr&SS_XMIT) != sscan_previous){
  				/*
! 			 	* If 500 ms timer has not expired then dont
! 			 	* check anything yet.
! 			 	* Check to see if DSR|CTS|CD are asserted.
! 			 	* If so we have a live connection.
! 			 	*/
! #				ifdef DEBUG
  				if (ssdebug)
! 					log(LOG_WARNING,"ssscan: MODEM Transition,sscan_modem=%x, sscan_prev=%x\n",sscan_modem,sscan_previous);
! #				endif DEBUG
  	   			/* 
! 	    	 		 * If ssdsr is set look for DSR|CTS|CD,else look
  	    	 		 * for CD|CTS only.
  	    	 		 */
  				if (ssdsr) {
--- 1254,1361 ----
  				 	* we should not look for CTS|CD for
  				 	* about 500 ms.  
  				 	*/
! 					if (!ss_modem_ctl) {
! 					  /* Assume carrier will come up in
! 					   * less than 1 sec. If not DSR will
! 					   * drop and the line will close.
! 					   */
! 					  timeout(ss_dsr_check, tp, hz);
! 					} else {
! 					  timeout(ss_dsr_check, tp, hz*30);
! 					  timeout(ss_dsr_check, tp, hz/2);
! 					}
  			    	}
  			}
  			/*
  			 * Look for modem transitions in an already established
  			 * connection.
+ 			 *
+ 			 * Ignore CD and CTS for PVAX. These signals don't
+ 			 * exist on the PVAX.
  			 */
! 			if (ss_modem_ctl) {
! 			    if (tp->t_state & TS_CARR_ON) {
  				if (ssaddr->ssmsr&SS_RCD) {
! 				    /*
! 				     * CD has come up again.
! 				     * Stop timeout from occurring if set.
! 				     * If interval is more than 2 secs then
! 				     *  drop DTR.
! 				     */
! 				    if ((ssmodem&MODEM_CD)==0) { 
! 					untimeout(ss_cd_drop, tp);
! 					if (ss_cd_down(tp)){
! 					    /* drop connection */
! 					    ss_tty_drop(tp);
  					}
+ 					ssmodem |= MODEM_CD;
+ 				    }
  				}
  				else {
+ 				    /* 
+ 				     * Carrier must be down for greater
+ 				     * than 2 secs before closing down
+ 				     * the line.
+ 				     */
+ 				    if ( ssmodem & MODEM_CD) {
+ 					/* only start timer once */
+ 					ssmodem &= ~MODEM_CD;
  					/* 
! 					 * Record present time so that if carrier
! 					 * comes up after 2 secs , the line will drop.
  					 */
! 					sstimestamp = time;
! 					timeout(ss_cd_drop, tp, hz*2);
! 				    }
  				}
  				/* CTS flow control check */
! 
  				if (!(ssaddr->ssmsr&SS_RCTS)) {
! 				    /* 
! 				     * Only allow transmission when CTS is set.
! 				     */
! 				    tp->t_state |= TS_TTSTOP;
! 				    ssmodem &= ~MODEM_CTS;
! #ifdef DEBUG
! 				    if (ssdebug)
! 				      log(LOG_WARNING,"ssscan: CTS stop, tp=%x,line=%d\n", tp,i);
! #endif DEBUG
! 				    ssstop(tp, 0);
  				} else if ((ssmodem&MODEM_CTS)==0) { 
! 				    /* 
! 				     * Restart transmission upon return of CTS.
! 				     */
! 				    tp->t_state &= ~TS_TTSTOP;
! 				    ssmodem |= MODEM_CTS;
  #					    ifdef DEBUG
! 				    if (ssdebug)
! 				      log(LOG_WARNING,"ssscan: CTS start, tp=%x,line=%d\n", tp,i);
  #					    endif DEBUG
! 				    ssstart(tp);
  				}
! 				
! 				
! 			    } 
! 			    
! 			    /* 
! 			     * See if a modem transition has occured.
! 			     * If we are waiting for this signal cause
! 			     * action to be taken via ss_tty_start.
! 			     */
! 			    if ((sscan_modem=ssaddr->ssmsr&SS_XMIT) != sscan_previous){
  				/*
! 				 * If 500 ms timer has not expired then dont
! 				 * check anything yet.
! 				 * Check to see if DSR|CTS|CD are asserted.
! 				 * If so we have a live connection.
! 				 */
! #ifdef DEBUG
  				if (ssdebug)
! 				  log(LOG_WARNING,"ssscan: MODEM Transition,sscan_modem=%x, sscan_prev=%x\n",sscan_modem,sscan_previous);
! #endif DEBUG
  	   			/* 
! 	    	 		 * If ssdsr is set look for DSR|CTS|CD,
! 				 * else look
  	    	 		 * for CD|CTS only.
  	    	 		 */
  				if (ssdsr) {
***************
*** 1331,1341 ****
  				    if (((ssaddr->ssmsr&SS_XMIT)==SS_XMIT) 
  				        && ((ssmodem&MODEM_DSR_START)==0)
  				        && ((tp->t_state&TS_CARR_ON)==0)) {
! #					    ifdef DEBUG
! 					    if (ssdebug)
! 						log(LOG_WARNING,"ssscan:SS_XMIT call ss_start,line=%d\n",i);
! #				            endif DEBUG
! 					    ss_start_tty(tp);
  				    }
  				}
  				/* 
--- 1362,1372 ----
  				    if (((ssaddr->ssmsr&SS_XMIT)==SS_XMIT) 
  				        && ((ssmodem&MODEM_DSR_START)==0)
  				        && ((tp->t_state&TS_CARR_ON)==0)) {
! #ifdef DEBUG
! 					if (ssdebug)
! 					  log(LOG_WARNING,"ssscan:SS_XMIT call ss_start,line=%d\n",i);
! #endif DEBUG
! 					ss_start_tty(tp);
  				    }
  				}
  				/* 
***************
*** 1342,1353 ****
  				 * Ignore DSR.	
  				 */
  				else
! 					if ((ssaddr->ssmsr&SS_NODSR)==SS_NODSR)
! 						ss_start_tty(tp);
! 						
  			}
! 			sscan_previous = sscan_modem; /* save for next iteration */
! 		}
  	}
  	for (i = 0; i < nNSS; i++) {
  		ave(ssrate[i], sschars[i], 8);
--- 1373,1385 ----
  				 * Ignore DSR.	
  				 */
  				else
! 				  if ((ssaddr->ssmsr&SS_NODSR)==SS_NODSR)
! 				    ss_start_tty(tp);
! 				
! 			    }
! 			    sscan_previous = sscan_modem; /* save for next iteration */
  			}
! 		    }
  	}
  	for (i = 0; i < nNSS; i++) {
  		ave(ssrate[i], sschars[i], 8);
***************
*** 1768,1777 ****
  	   	/* 
  	    	 * If ssdsr is set look for DSR|CTS|CD, otherwise look 
  	    	 * for CD|CTS only.
  	    	 */
  		if (ssdsr) {
! 			if ((ssaddr->ssmsr&SS_XMIT) == SS_XMIT)
! 				ss_start_tty(tp);
  		}
  		else {
  			if ((ssaddr->ssmsr&SS_NODSR) == SS_NODSR)
--- 1800,1812 ----
  	   	/* 
  	    	 * If ssdsr is set look for DSR|CTS|CD, otherwise look 
  	    	 * for CD|CTS only.
+ 		 *
+ 		 * If cpu is PVAX then don't bother looking at CD or CTS
+ 		 * just let the connection continue.
  	    	 */
  		if (ssdsr) {
! 		    if ((!ss_modem_ctl) || ((ssaddr->ssmsr&SS_XMIT) == SS_XMIT))
! 		      ss_start_tty(tp);
  		}
  		else {
  			if ((ssaddr->ssmsr&SS_NODSR) == SS_NODSR)

home help back first fref pref prev next nref lref last post