diff src/cs/drivers/drv_app/uart/uartfax.c @ 681:140a0d24a64c

Tango pinmux implemented except for GPIO1 special outputs, which will be implemented later.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 25 Jun 2020 05:36:24 +0000
parents 92dbfa906f66
children 17b7b92e7dba
line wrap: on
line diff
--- a/src/cs/drivers/drv_app/uart/uartfax.c	Thu Jun 25 03:17:43 2020 +0000
+++ b/src/cs/drivers/drv_app/uart/uartfax.c	Thu Jun 25 05:36:24 2020 +0000
@@ -118,6 +118,10 @@
   #include "armio/armio.h"
 #endif
 
+#ifdef CONFIG_TANGO_MODEM
+extern SYS_UWORD8 AI_Tango_pinmux[4];
+#endif
+
 /* 
  * Maximal value for an unsigned 32 bits.
  */
@@ -3021,9 +3025,15 @@
      * DCD should start HIGH (not asserted).
      */
 
+#ifdef CONFIG_TANGO_MODEM
+  if (AI_Tango_pinmux[1] & 0x08) {
+#endif
     *((volatile SYS_UWORD16 *) EXTENDED_MCU_REG) &= ~(1 << IO_DCD);
     AI_ConfigBitAsOutput (ARMIO_DCD);
     AI_SetBit (ARMIO_DCD);
+#ifdef CONFIG_TANGO_MODEM
+  }
+#endif
 
     /*
      * Select I/O for DTR and configure it as input.
@@ -3031,6 +3041,9 @@
      * or rising edge is selected according to the state of DTR.
      */
     
+#ifdef CONFIG_TANGO_MODEM
+  if (AI_Tango_pinmux[1] & 0x80) {
+#endif
     *((volatile SYS_UWORD16 *) ASIC_CONFIG_REG) &= ~(1 << IO_DTR);
     AI_ConfigBitAsInput (ARMIO_DTR);
     uart->dtr_level = AI_ReadBit (ARMIO_DTR);
@@ -3041,6 +3054,10 @@
         AI_SelectIOForIT (ARMIO_DTR, ARMIO_RISING_EDGE);
         
     AI_UnmaskIT (ARMIO_MASKIT_GPIO);
+#ifdef CONFIG_TANGO_MODEM
+  } else
+    uart->dtr_level = 0;
+#endif
 
     /*
      * Reset the 2 indexes of the circular buffer of 2 elements.
@@ -3223,7 +3240,10 @@
 
     WRITE_UART_REGISTER (uart, IER, 0x00);
 
-#if UARTFAX_CLASSIC_DTR_DCD
+#ifdef CONFIG_TANGO_MODEM
+    if (AI_Tango_pinmux[1] & 0x80)
+      AI_MaskIT (ARMIO_MASKIT_GPIO);
+#elif UARTFAX_CLASSIC_DTR_DCD
     AI_MaskIT (ARMIO_MASKIT_GPIO);
 #elif (CHIPSET == 12)
     DISABLE_DSR_INTERRUPT (uart);
@@ -3369,6 +3389,9 @@
      * Read the state of DTR and select the edge.
      */
          
+#ifdef CONFIG_TANGO_MODEM
+  if (AI_Tango_pinmux[1] & 0x80) {
+#endif
     uart->dtr_level = AI_ReadBit (ARMIO_DTR);
     
     if (uart->dtr_level)
@@ -3377,6 +3400,11 @@
         AI_SelectIOForIT (ARMIO_DTR, ARMIO_RISING_EDGE);
         
     AI_UnmaskIT (ARMIO_MASKIT_GPIO);
+#ifdef CONFIG_TANGO_MODEM
+  } else
+    uart->dtr_level = 0;
+#endif
+
 #elif (CHIPSET == 12)
     /*
      * Read the state of DTR - No need to reload MSR register since its value
@@ -4755,6 +4783,9 @@
             /* Turn on DCD */
             #if (CHIPSET == 12)
                 WRITE_UART_REGISTER (uart, MCR, READ_UART_REGISTER(uart, MCR) | MDCD);
+            #elif defined(CONFIG_TANGO_MODEM)
+                if (AI_Tango_pinmux[1] & 0x08)
+                    AI_ResetBit (ARMIO_DCD);
             #else
                 AI_ResetBit (ARMIO_DCD);
             #endif
@@ -4762,6 +4793,9 @@
             /* Turn off DCD */
             #if (CHIPSET == 12)
                 WRITE_UART_REGISTER (uart, MCR, READ_UART_REGISTER(uart, MCR) & ~MDCD);
+            #elif defined(CONFIG_TANGO_MODEM)
+                if (AI_Tango_pinmux[1] & 0x08)
+                    AI_SetBit (ARMIO_DCD);
             #else
                 AI_SetBit (ARMIO_DCD);
             #endif
@@ -4791,6 +4825,9 @@
             /* Turn on DCD */
             #if (CHIPSET == 12)
                 WRITE_UART_REGISTER (uart, MCR, READ_UART_REGISTER(uart, MCR) | MDCD);
+            #elif defined(CONFIG_TANGO_MODEM)
+                if (AI_Tango_pinmux[1] & 0x08)
+                    AI_ResetBit (ARMIO_DCD);
             #else
                 AI_ResetBit (ARMIO_DCD);
             #endif
@@ -4798,6 +4835,9 @@
             /* Turn off DCD */
             #if (CHIPSET == 12)
                 WRITE_UART_REGISTER (uart, MCR, READ_UART_REGISTER(uart, MCR) & ~MDCD);
+            #elif defined(CONFIG_TANGO_MODEM)
+                if (AI_Tango_pinmux[1] & 0x08)
+                    AI_SetBit (ARMIO_DCD);
             #else
                 AI_SetBit (ARMIO_DCD);
             #endif