casaroli commented on code in PR #3811:
URL: https://github.com/apache/nuttx-apps/pull/3811#discussion_r4248098730


##########
examples/pmstress/pmstress_main.c:
##########
@@ -0,0 +1,382 @@
+/****************************************************************************
+ * apps/examples/pmstress/pmstress_main.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Walk the power management states in a fixed, timed sequence, so that a
+ * logging supply can record the current of each state with nothing
+ * attached to the board.  A full-speed burst separates the steps, so the
+ * trace shows where each one starts.  The last step is the deepest state.
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/boardctl.h>
+#include <sys/ioctl.h>
+#include <sys/param.h>
+
+#include <inttypes.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include <nuttx/power/pm.h>
+#include <nuttx/leds/userled.h>
+#include <nuttx/timers/rtc.h>
+
+#ifdef CONFIG_ARCH_CHIP_RP23XX
+#  include <arch/chip/pm.h>
+#endif
+
+#if defined(BOARDIOC_RP23XX_SUSPEND) && defined(CONFIG_RTC_DRIVER) && \
+    defined(CONFIG_RTC_ALARM)
+#  define HAVE_SUSPEND
+#endif
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define MARKER_MS      1000    /* Length of the burst between steps */
+#define PM_DOMAIN      0       /* PM_IDLE_DOMAIN */
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct pmstress_step_s
+{
+  FAR const char *name;
+  int             state;    /* State to hold the domain at, -1 for none */
+  int             seconds;  /* How long, 0 for ever */
+};
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const struct pmstress_step_s g_steps[] =
+{
+  {
+    "active  (full speed, busy)", PM_NORMAL,
+    CONFIG_EXAMPLES_PMSTRESS_STEP_SECS
+  },
+  {
+    "idle    (full speed, wfi)", PM_NORMAL,
+    CONFIG_EXAMPLES_PMSTRESS_STEP_SECS
+  },
+  {
+    "standby (clocks gated)", PM_STANDBY,
+    CONFIG_EXAMPLES_PMSTRESS_STEP_SECS
+  },
+  {
+    "sleep   (deepest state)", -1, 0
+  },
+};
+
+/* The state this program holds the domain at, or -1 */
+
+static int g_held = -1;

Review Comment:
   Done. The held state is now a local variable in main(), passed to 
pmstress_hold().



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to