anchao commented on code in PR #6286:
URL: https://github.com/apache/incubator-nuttx/pull/6286#discussion_r876218398


##########
arch/z80/include/irq.h:
##########
@@ -32,4 +32,55 @@
 #include <nuttx/irq.h>
 #include <arch/chip/irq.h>
 
+#ifndef __ASSEMBLY__
+#  include <stdbool.h>
+#  include "chip/switch.h"
+#endif
+
+/****************************************************************************
+ * Inline functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_interrupt_context
+ *
+ * Description:
+ *   Return true is we are currently executing in the interrupt
+ *   handler context.
+ *
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+static inline bool up_interrupt_context(void)
+{
+  return IN_INTERRUPT();
+}
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_cpu_index
+ *
+ * Description:
+ *   Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
+ *   corresponds to the currently executing CPU.
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
+ *   corresponds to the currently executing CPU.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SMP
+int up_cpu_index(void);
+#else
+#  define up_cpu_index() (0)
+#endif
+#endif

Review Comment:
   irq.h will be included before arch.h during preprocessing phase
   
   ```
   In file included from incubator-nuttx/include/nuttx/irq.h:37,
                    from incubator-nuttx/include/nuttx/sched.h:39,
                    from incubator-nuttx/include/nuttx/arch.h:87,
                    from incubator-nuttx/include/nuttx/userspace.h:35,
                    from n2/incubator-nuttx/include/nuttx/kmalloc.h:36,
                    from incubator-nuttx/include/nuttx/lib/lib.h:31,
                    from libxx_cxa_atexit.cxx:27:
   incubator-nuttx/include/arch/irq.h: In function 'bool 
up_interrupt_context()':
   incubator-nuttx/include/arch/irq.h:135:14: error: 'up_cpu_index' was not 
declared in this scope
     135 |   bool ret = CURRENT_REGS != NULL;
         |              ^~~~~~~~~~~~
   ```



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