You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2022/02/01 13:50:31 UTC

[GitHub] [mynewt-nimble] kasjer commented on a change in pull request #1160: nimble/transport/cmac: Flush UART on CMAC error

kasjer commented on a change in pull request #1160:
URL: https://github.com/apache/mynewt-nimble/pull/1160#discussion_r796611542



##########
File path: nimble/transport/dialog_cmac/cmac_driver/src/cmac_host.c
##########
@@ -147,6 +163,34 @@ cmac_host_rand_chk_fill(void)
     }
 }
 
+#if MYNEWT_VAL(BLE_HCI_BRIDGE) && MYNEWT_VAL_CHOICE(BLE_HCI_TRANSPORT, uart)
+#if MYNEWT_VAL(BLE_HCI_UART_PORT) < 0 || MYNEWT_VAL(BLE_HCI_UART_PORT) > 2
+#error Invalid BLE_HCI_UART_PORT
+#endif
+static void
+cmac_host_error_w4flush(struct os_event *ev)
+{
+    static const UART_Type *regs[] = {
+            (void *)UART,
+            (void *)UART2,
+            (void *)UART3
+    };
+
+    if (!ev) {
+        /* Move to task context, we do not want to spin in interrupt */
+        os_eventq_put(os_eventq_dflt_get(), &g_cmac_host_error_ev);
+        return;
+    }
+
+    while ((regs[MYNEWT_VAL(BLE_HCI_UART_PORT)]->UART_LSR_REG &
+            UART_UART_LSR_REG_UART_TEMT_Msk) == 0) {
+        /* Wait until both FIFO and shift registers are empty */
+    };

Review comment:
       semicolon after `}` is not really needed

##########
File path: nimble/transport/dialog_cmac/cmac_driver/src/cmac_host.c
##########
@@ -147,6 +163,34 @@ cmac_host_rand_chk_fill(void)
     }
 }
 
+#if MYNEWT_VAL(BLE_HCI_BRIDGE) && MYNEWT_VAL_CHOICE(BLE_HCI_TRANSPORT, uart)
+#if MYNEWT_VAL(BLE_HCI_UART_PORT) < 0 || MYNEWT_VAL(BLE_HCI_UART_PORT) > 2
+#error Invalid BLE_HCI_UART_PORT
+#endif
+static void
+cmac_host_error_w4flush(struct os_event *ev)
+{
+    static const UART_Type *regs[] = {

Review comment:
       I guess `const` should be before `regs`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org