pkarashchenko commented on code in PR #7808:
URL: https://github.com/apache/nuttx/pull/7808#discussion_r1043087896


##########
include/nuttx/misc/panic.h:
##########
@@ -0,0 +1,77 @@
+/****************************************************************************
+ * include/nuttx/misc/panic.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_NUTTX_MISC_PANIC_H
+#define __INCLUDE_NUTTX_MISC_PANIC_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/notifier.h>
+
+#include <sys/types.h>
+
+/****************************************************************************
+ * Public Function
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  panic_notifier_chain_register
+ *
+ * Description:
+ *   Add notifier to the panic notifier chain
+ *
+ * Input Parameters:
+ *    nb - New entry in notifier chain
+ *
+ ****************************************************************************/
+
+void panic_notifier_chain_register(struct notifier_block *nb);
+
+/****************************************************************************
+ * Name:  panic_notifier_chain_unregister
+ *
+ * Description:
+ *   Remove notifier from the panic notifier chain
+ *
+ * Input Parameters:
+ *    nb - Entry to remove from notifier chain
+ *
+ ****************************************************************************/
+
+void panic_notifier_chain_unregister(struct notifier_block *nb);

Review Comment:
   ```suggestion
   void panic_notifier_chain_unregister(FAR struct notifier_block *nb);
   ```



##########
sched/misc/panic.c:
##########
@@ -0,0 +1,88 @@
+/****************************************************************************
+ * sched/misc/panic.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/arch.h>
+#include <nuttx/notifier.h>
+
+#include <sys/types.h>
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+ATOMIC_NOTIFIER_HEAD(g_panic_notifier_list);
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  panic_notifier_chain_register
+ *
+ * Description:
+ *   Add notifier to the panic notifier chain
+ *
+ * Input Parameters:
+ *    nb - New entry in notifier chain
+ *
+ ****************************************************************************/
+
+void panic_notifier_chain_register(struct notifier_block *nb)
+{
+  atomic_notifier_chain_register(&g_panic_notifier_list, nb);
+}
+
+/****************************************************************************
+ * Name:  panic_notifier_chain_unregister
+ *
+ * Description:
+ *   Remove notifier from the panic notifier chain
+ *
+ * Input Parameters:
+ *    nb - Entry to remove from notifier chain
+ *
+ ****************************************************************************/
+
+void panic_notifier_chain_unregister(struct notifier_block *nb)

Review Comment:
   ```suggestion
   void panic_notifier_chain_unregister(FAR struct notifier_block *nb)
   ```



##########
arch/arm64/src/common/arm64_initialize.c:
##########
@@ -127,6 +136,23 @@ static void up_color_intstack(void)
 # define up_color_intstack()
 #endif
 
+/****************************************************************************
+ * Name: arm64_assert_disable_fpu
+ *
+ * Description:
+ *   This is called when assert to close fpu.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_FPU
+int arm64_assert_disable_fpu(FAR struct notifier_block *this,
+                              unsigned long action, FAR void *data)

Review Comment:
   ```suggestion
   int arm64_assert_disable_fpu(struct notifier_block *this,
                                unsigned long action, void *data)
   ```



##########
sched/misc/panic.c:
##########
@@ -0,0 +1,88 @@
+/****************************************************************************
+ * sched/misc/panic.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/arch.h>
+#include <nuttx/notifier.h>
+
+#include <sys/types.h>
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+ATOMIC_NOTIFIER_HEAD(g_panic_notifier_list);
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  panic_notifier_chain_register
+ *
+ * Description:
+ *   Add notifier to the panic notifier chain
+ *
+ * Input Parameters:
+ *    nb - New entry in notifier chain
+ *
+ ****************************************************************************/
+
+void panic_notifier_chain_register(struct notifier_block *nb)

Review Comment:
   ```suggestion
   void panic_notifier_chain_register(FAR struct notifier_block *nb)
   ```



##########
include/nuttx/misc/panic.h:
##########
@@ -0,0 +1,77 @@
+/****************************************************************************
+ * include/nuttx/misc/panic.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_NUTTX_MISC_PANIC_H
+#define __INCLUDE_NUTTX_MISC_PANIC_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/notifier.h>
+
+#include <sys/types.h>
+
+/****************************************************************************
+ * Public Function
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  panic_notifier_chain_register
+ *
+ * Description:
+ *   Add notifier to the panic notifier chain
+ *
+ * Input Parameters:
+ *    nb - New entry in notifier chain
+ *
+ ****************************************************************************/
+
+void panic_notifier_chain_register(struct notifier_block *nb);

Review Comment:
   ```suggestion
   void panic_notifier_chain_register(FAR struct notifier_block *nb);
   ```



##########
sched/misc/assert.c:
##########
@@ -23,16 +23,99 @@
  ****************************************************************************/
 
 #include <nuttx/arch.h>
+#include <nuttx/board.h>
+#include <nuttx/misc/panic.h>
+#include <nuttx/usb/usbdev_trace.h>
+#include <nuttx/syslog/syslog.h>
 
 #include <assert.h>
+#include <debug.h>
 #include <stdlib.h>
 
+#include "sched/sched.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* USB trace dumping */
+
+#ifndef CONFIG_USBDEV_TRACE
+#  undef CONFIG_ARCH_USBDUMP
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: assert_tracecallback
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_USBDUMP
+static int usbtrace_syslog(FAR const char *fmt, ...)
+{
+  va_list ap;
+
+  /* Let vsyslog do the real work */
+
+  va_start(ap, fmt);
+  vsyslog(LOG_EMERG, fmt, ap);
+  va_end(ap);
+  return OK;
+}
+
+static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
+{
+  usbtrace_trprintf(FAR usbtrace_syslog, trace->event, trace->value);

Review Comment:
   ```suggestion
     usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value);
   ```



-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to