PERFORCE change 36796 for review

Marcel Moolenaar marcel at FreeBSD.org
Sat Aug 23 17:26:32 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=36796

Change 36796 by marcel at marcel_nfs on 2003/08/23 17:25:44

	Fix DTR: The state of DTR is inverted. To set DTR we need to
	clear the DTR bit in PVR.
	While here, fix RTS as well. The documentation states that
	if SAB_MODE_RTS is set, SAB_MODE_FRTS controls the state of
	the RTS signal. This too is inverted.

Affected files ...

.. //depot/projects/uart/dev/uart/uart_dev_sab82532.c#13 edit

Differences ...

==== //depot/projects/uart/dev/uart/uart_dev_sab82532.c#13 (text+ko) ====

@@ -185,8 +185,13 @@
 	if (bas->rclk == 0)
 		bas->rclk = DEFAULT_RCLK;
 
-	/* Set all pins, except DTR pins to be inputs. */
-	uart_setreg(bas, SAB_PCR, ~(SAB_PVR_DTR_A | SAB_PVR_DTR_B));
+	/*
+	 * Set all pins, except the DTR pins (pin 1 and 2) to be inputs.
+	 * Pin 4 is magical, meaning that I don't know what it does, but
+	 * it too has to be set to output.
+	 */
+	uart_setreg(bas, SAB_PCR,
+	    ~(SAB_PVR_DTR_A|SAB_PVR_DTR_B|SAB_PVR_MAGIC));
 	uart_barrier(bas);
 	/* Disable port interrupts. */
 	uart_setreg(bas, SAB_PIM, 0xff);
@@ -196,8 +201,8 @@
 	uart_barrier(bas);
 	/* Set DTR. */
 	pvr = uart_getreg(bas, SAB_PVR);
-	pvr |= IS_CHANNEL_A(bas) ? SAB_PVR_DTR_A : SAB_PVR_DTR_B;
-	uart_setreg(bas, SAB_PVR, pvr);
+	pvr &= IS_CHANNEL_A(bas) ? ~SAB_PVR_DTR_A : ~SAB_PVR_DTR_B;
+	uart_setreg(bas, SAB_PVR, pvr | SAB_PVR_MAGIC);
 	uart_barrier(bas);
 
 	/* power down */
@@ -216,7 +221,7 @@
 	uart_barrier(bas);
 	uart_setreg(bas, SAB_CCR4, SAB_CCR4_MCK4|SAB_CCR4_EBRG|SAB_CCR4_ICD);
 	uart_barrier(bas);
-	uart_setreg(bas, SAB_MODE, SAB_MODE_RTS|SAB_MODE_FCTS|SAB_MODE_RAC);
+	uart_setreg(bas, SAB_MODE, SAB_MODE_RTS|SAB_MODE_RAC);
 	uart_barrier(bas);
 	uart_setreg(bas, SAB_RFC, SAB_RFC_DPS|SAB_RFC_RFDF|
 	    SAB_RFC_RFTH_32CHAR);
@@ -252,7 +257,7 @@
 	uint8_t pvr;
 
 	pvr = uart_getreg(bas, SAB_PVR);
-	pvr &= IS_CHANNEL_A(bas) ? ~SAB_PVR_DTR_A : ~SAB_PVR_DTR_B;
+	pvr |= IS_CHANNEL_A(bas) ? SAB_PVR_DTR_A : SAB_PVR_DTR_B;
 	uart_setreg(bas, SAB_PVR, pvr);
 	uart_barrier(bas);
 }
@@ -546,15 +551,15 @@
 	}
 	pvr = uart_getreg(bas, SAB_PVR);
 	if (sc->sc_hwsig & UART_SIG_DTR)
+		pvr &= (IS_CHANNEL_A(bas)) ? ~SAB_PVR_DTR_A : ~SAB_PVR_DTR_B;
+	else
 		pvr |= (IS_CHANNEL_A(bas)) ? SAB_PVR_DTR_A : SAB_PVR_DTR_B;
-	else
-		pvr &= (IS_CHANNEL_A(bas)) ? ~SAB_PVR_DTR_A : ~SAB_PVR_DTR_B;
 	uart_setreg(bas, SAB_PVR, pvr);
 	mode = uart_getreg(bas, SAB_MODE);
 	if (sc->sc_hwsig & UART_SIG_RTS)
-		mode |= SAB_MODE_RTS;
+		mode &= ~SAB_MODE_FRTS;
 	else
-		mode &= ~SAB_MODE_RTS;
+		mode |= SAB_MODE_FRTS;
 	uart_setreg(bas, SAB_MODE, mode);
 	uart_barrier(bas);
         if (sig & UART_SIG_DBREAK) {


More information about the p4-projects mailing list