Update UART LLD for PP discovered issues.
authorFrank Livingston <frank-livingston@ti.com>
Fri, 8 Jul 2016 00:44:26 +0000 (19:44 -0500)
committerFrank Livingston <frank-livingston@ti.com>
Fri, 8 Jul 2016 00:44:26 +0000 (19:44 -0500)
NOTE: This version includes code NOT in the PSDK 2.0.3 UART LLD release.

pdk_k2g_1_0_1/packages/ti/drv/uart/src/v0/UARTDMA_v0.c
pdk_k2g_1_0_1/packages/ti/drv/uart/src/v0/UART_v0.c

index b330fa8e893e92d993be23f4848cb864cfd77589..b86059c9e096eee0442a029eb088c02803c512f7 100644 (file)
@@ -39,7 +39,7 @@
 #include <stdint.h>
 #include <ti/drv/uart/UART.h>
 #include <ti/drv/uart/src/v0/UART_dma_v0.h>
-#include <ti/drv/uart/src/v0/UART_lld_v0.h>
+#include <ti/csl/src/ip/uart/V0/uart.h>
 #include <ti/drv/uart/src/UART_osal.h>
 #include <ti/sdo/edma3/drv/edma3_drv.h>
 #include <ti/csl/src/ip/uart/V0/cslr_uart.h>
@@ -334,9 +334,17 @@ static void UARTDMA_close_v0(UART_Handle handle)
               hwAttrs->txDmaEventNumber);
 
     /* Destruct the SYS/BIOS objects. */
+#ifdef UART_INTERRUPT_ENABLE
     UART_osalHardwareIntDestruct(object->hwi);
-    UART_osalDeleteBlockingLock(object->writeSem);
-    UART_osalDeleteBlockingLock(object->readSem);
+#endif
+    if (object->params.writeMode == UART_MODE_BLOCKING)
+    {
+        UART_osalDeleteBlockingLock(object->writeSem);
+    }
+    if (object->params.readMode == UART_MODE_BLOCKING)
+    {
+        UART_osalDeleteBlockingLock(object->readSem);
+    }
 
     object->isOpen = (uint32_t)FALSE;
 
index 2ce16fb3befc075399b1ceff9b37377c5efc773f..07dbee3e5a8e663871e185cbd7da6cb9d376a77b 100644 (file)
@@ -39,7 +39,7 @@
 #include <stdint.h>
 #include <ti/drv/uart/UART.h>
 #include <ti/drv/uart/src/v0/UART_v0.h>
-#include <ti/drv/uart/src/v0/UART_lld_v0.h>
+#include <ti/csl/src/ip/uart/V0/uart.h>
 #include <ti/drv/uart/src/UART_osal.h>
 #include <ti/drv/uart/src/UART_drv_log.h>
 
@@ -467,7 +467,8 @@ static UART_Handle UART_open_v0(UART_Handle handle, const UART_Params *params)
             UART_pwremuConfig_v0(hwAttrs->baseAddr, UART_PWREMU_MGMT_ENABLE);
 
             /* Setting the RX FIFO Trigger levels as 1. No DMA enabled. */
-            fifoConfig = UART_FIFO_CONFIG(UART_FIFO_RXTL1, UART_FIFO_TXCLR, UART_FIFO_RXCLR, UART_FIFO_DMAMODE1_DISABLE);
+            fifoConfig = UART_FIFO_CONFIG(UART_FIFO_RXTL0, UART_FIFO_TXCLR, UART_FIFO_RXCLR, UART_FIFO_DMAMODE1_DISABLE);
+
             /* Configuring the FIFO settings. */
             UART_fIFOConfig_v0(hwAttrs->baseAddr, fifoConfig);
 
@@ -520,8 +521,14 @@ static void UART_close_v0(UART_Handle handle)
 
     /* Destruct the SYS/BIOS objects. */
     UART_osalHardwareIntDestruct(object->hwi);
-    UART_osalDeleteBlockingLock(object->writeSem);
-    UART_osalDeleteBlockingLock(object->readSem);
+    if (object->params.writeMode == UART_MODE_BLOCKING)
+    {
+        UART_osalDeleteBlockingLock(object->writeSem);
+    }
+    if (object->params.readMode == UART_MODE_BLOCKING)
+    {
+        UART_osalDeleteBlockingLock(object->readSem);
+    }
 
     object->isOpen = (uint32_t)FALSE;
 
@@ -591,9 +598,9 @@ static int32_t UART_write_v0(UART_Handle handle, const void *buffer, size_t size
         /* If writeMode is blocking, block and get the status. */
         else 
         {
+            UART_intEnable_v0(hwAttrs->baseAddr, UART_INT_THR);
             if (object->params.writeMode == UART_MODE_BLOCKING)
             {
-                UART_intEnable_v0(hwAttrs->baseAddr, UART_INT_THR);
                 /* Pend on lock and wait for Hwi to finish. */
                 if (UART_osalPendLock((object->writeSem),
                                     object->params.writeTimeout) == 0U)
@@ -755,9 +762,9 @@ static int32_t UART_read_v0(UART_Handle handle, void *buffer, size_t size)
         /* If readMode is blocking, block and get the status. */
         else
         {
+            UART_intEnable_v0(hwAttrs->baseAddr, UART_INT_RHR_CTI);
             if (object->params.readMode == UART_MODE_BLOCKING)
             {
-                UART_intEnable_v0(hwAttrs->baseAddr, UART_INT_RHR_CTI);
                 /* Pend on lock and wait for Hwi to finish. */
                 if (UART_osalPendLock((object->readSem),
                                     object->params.readTimeout) == 0U)