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 10:11:42 UTC

[GitHub] [mynewt-nimble] andrzej-kaczmarek opened a new pull request #1160: nimble/transport/cmac: Flush UART on CMAC error

andrzej-kaczmarek opened a new pull request #1160:
URL: https://github.com/apache/mynewt-nimble/pull/1160


   When CMAC is used with HCI bridge over UART we should wait for all
   data to be flushed from UART before asserting on error, otherwise we
   will lose debug events.


-- 
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



[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on pull request #1160: nimble/transport/cmac: Flush UART on CMAC error

Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek commented on pull request #1160:
URL: https://github.com/apache/mynewt-nimble/pull/1160#issuecomment-1027796280


   As it turns out, resetting CMAC in cmac2sys interrupt is not a good idea since it probably will be reset before debug events are written to mbox from fault handler. So we better only disable cmac2sys interrupt (so we don't keep spinning in that interrupt since we cannot clear CMAC error) and then wait in task context until both mbox and UART are flushed.


-- 
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



[GitHub] [mynewt-nimble] andrzej-kaczmarek merged pull request #1160: nimble/transport/cmac: Flush UART on CMAC error

Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek merged pull request #1160:
URL: https://github.com/apache/mynewt-nimble/pull/1160


   


-- 
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



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

Posted by GitBox <gi...@apache.org>.
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