[rtems commit] grlib: make apbuart driver independent of bsp

Sebastian Huber sebh at rtems.org
Tue Jan 22 11:53:18 UTC 2019


Module:    rtems
Branch:    master
Commit:    411c29735d8a824704384d12acfca06dc78db232
Changeset: http://git.rtems.org/rtems/commit/?id=411c29735d8a824704384d12acfca06dc78db232

Author:    Jiri Gaisler <jiri at gaisler.se>
Date:      Fri Jan 18 11:24:18 2019 +0100

grlib: make apbuart driver independent of bsp

Update #3678.

---

 bsps/include/grlib/apbuart.h          |  1 +
 bsps/shared/grlib/uart/apbuart_cons.c | 32 ++++++++++++++++----------------
 bsps/sparc/leon2/include/leon.h       |  1 -
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/bsps/include/grlib/apbuart.h b/bsps/include/grlib/apbuart.h
index d30ad0b..6a89bb9 100644
--- a/bsps/include/grlib/apbuart.h
+++ b/bsps/include/grlib/apbuart.h
@@ -37,6 +37,7 @@ extern "C" {
 #define APBUART_CTRL_EC 0x100
 #define APBUART_CTRL_TF 0x200
 #define APBUART_CTRL_RF 0x400
+#define APBUART_CTRL_DB 0x800
 #define APBUART_CTRL_BI 0x1000
 #define APBUART_CTRL_DI 0x2000
 #define APBUART_CTRL_FA 0x80000000
diff --git a/bsps/shared/grlib/uart/apbuart_cons.c b/bsps/shared/grlib/uart/apbuart_cons.c
index 8cd8a1e..ee635e6 100644
--- a/bsps/shared/grlib/uart/apbuart_cons.c
+++ b/bsps/shared/grlib/uart/apbuart_cons.c
@@ -260,10 +260,10 @@ int apbuart_init1(struct drvmgr_dev *dev)
 	db = 0;
 #ifdef LEON3
 	if (priv->regs == leon3_debug_uart) {
-		db = priv->regs->ctrl & (LEON_REG_UART_CTRL_RE |
-					LEON_REG_UART_CTRL_TE |
-					LEON_REG_UART_CTRL_PE |
-					LEON_REG_UART_CTRL_PS);
+		db = priv->regs->ctrl & (APBUART_CTRL_RE |
+					APBUART_CTRL_TE |
+					APBUART_CTRL_PE |
+					APBUART_CTRL_PS);
 	}
 #endif
 	/* Let UART debug tunnelling be untouched if Flow-control is set.
@@ -273,9 +273,9 @@ int apbuart_init1(struct drvmgr_dev *dev)
 	 * guess that we are debugging if FL is already set, the debugger set
 	 * either LB or DB depending on UART capabilities.
 	 */
-	if (priv->regs->ctrl & LEON_REG_UART_CTRL_FL) {
-		db |= priv->regs->ctrl & (LEON_REG_UART_CTRL_DB |
-		      LEON_REG_UART_CTRL_LB | LEON_REG_UART_CTRL_FL);
+	if (priv->regs->ctrl & APBUART_CTRL_FL) {
+		db |= priv->regs->ctrl & (APBUART_CTRL_DB |
+		      APBUART_CTRL_LB | APBUART_CTRL_FL);
 	}
 
 	priv->regs->ctrl = db;
@@ -561,26 +561,26 @@ static bool set_attributes(
 	switch(t->c_cflag & (PARENB|PARODD)){
 		case (PARENB|PARODD):
 			/* Odd parity */
-			ctrl |= LEON_REG_UART_CTRL_PE|LEON_REG_UART_CTRL_PS;
+			ctrl |= APBUART_CTRL_PE|APBUART_CTRL_PS;
 			break;
 
 		case PARENB:
 			/* Even parity */
-			ctrl &= ~LEON_REG_UART_CTRL_PS;
-			ctrl |= LEON_REG_UART_CTRL_PE;
+			ctrl &= ~APBUART_CTRL_PS;
+			ctrl |= APBUART_CTRL_PE;
 			break;
 
 		default:
 		case 0:
 		case PARODD:
 			/* No Parity */
-			ctrl &= ~(LEON_REG_UART_CTRL_PS|LEON_REG_UART_CTRL_PE);
+			ctrl &= ~(APBUART_CTRL_PS|APBUART_CTRL_PE);
 	}
 
 	if (!(t->c_cflag & CLOCAL))
-		ctrl |= LEON_REG_UART_CTRL_FL;
+		ctrl |= APBUART_CTRL_FL;
 	else
-		ctrl &= ~LEON_REG_UART_CTRL_FL;
+		ctrl &= ~APBUART_CTRL_FL;
 
 	/* Update new settings */
 	uart->regs->ctrl = ctrl;
@@ -618,14 +618,14 @@ static void get_attributes(
 
 	/* Read out current parity */
 	ctrl = uart->regs->ctrl;
-	if (ctrl & LEON_REG_UART_CTRL_PE) {
-		if (ctrl & LEON_REG_UART_CTRL_PS)
+	if (ctrl & APBUART_CTRL_PE) {
+		if (ctrl & APBUART_CTRL_PS)
 			t->c_cflag |= PARENB|PARODD; /* Odd parity */
 		else
 			t->c_cflag |= PARENB; /* Even parity */
 	}
 
-	if ((ctrl & LEON_REG_UART_CTRL_FL) == 0)
+	if ((ctrl & APBUART_CTRL_FL) == 0)
 		t->c_cflag |= CLOCAL;
 
 	rtems_termios_set_best_baud(t, apbuart_get_baud(uart));
diff --git a/bsps/sparc/leon2/include/leon.h b/bsps/sparc/leon2/include/leon.h
index bba06e5..7ec6b1d 100644
--- a/bsps/sparc/leon2/include/leon.h
+++ b/bsps/sparc/leon2/include/leon.h
@@ -266,7 +266,6 @@ typedef struct {
 #define LEON_REG_UART_CTRL_PE     0x00000020 /* Parity enable */
 #define LEON_REG_UART_CTRL_FL     0x00000040 /* Flow control enable */
 #define LEON_REG_UART_CTRL_LB     0x00000080 /* Loop Back enable */
-#define LEON_REG_UART_CTRL_DB     0x00000800 /* Debug FIFO enable */
 
 #ifndef ASM
 




More information about the vc mailing list