summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-09-01 15:09:49 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-09-01 15:09:49 +0000
commit0c65db21d1bdc2ca3419f947288e08033f890662 (patch)
treec5a3ae24fb1e857edd2ea9b40faddf11a2be7024
parent0ec4fcc28f0c8601c4205d73a7e7f93f44f3c8e3 (diff)
downloadpx4-nuttx-0c65db21d1bdc2ca3419f947288e08033f890662.tar.gz
px4-nuttx-0c65db21d1bdc2ca3419f947288e08033f890662.tar.bz2
px4-nuttx-0c65db21d1bdc2ca3419f947288e08033f890662.zip
Add NSH date command
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3932 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--apps/nshlib/Makefile5
-rw-r--r--apps/nshlib/nsh.h6
-rw-r--r--apps/nshlib/nsh_parse.c4
-rw-r--r--apps/nshlib/nsh_timcmds.c330
-rw-r--r--nuttx/Documentation/NuttX.html2
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_rtc.c13
-rwxr-xr-xnuttx/configs/vsn/nsh/defconfig6
-rw-r--r--nuttx/include/nuttx/pm.h175
8 files changed, 496 insertions, 45 deletions
diff --git a/apps/nshlib/Makefile b/apps/nshlib/Makefile
index a838f9589..91ffc2c5e 100644
--- a/apps/nshlib/Makefile
+++ b/apps/nshlib/Makefile
@@ -55,6 +55,10 @@ ifeq ($(CONFIG_NET),y)
CSRCS += nsh_netinit.c nsh_netcmds.c
endif
+ifeq ($(CONFIG_RTC),y)
+CSRCS += nsh_timcmds.c
+endif
+
ifeq ($(CONFIG_NSH_CONSOLE),y)
CSRCS += nsh_serial.c
endif
@@ -67,6 +71,7 @@ ifneq ($(CONFIG_NSH_DISABLESCRIPT),y)
CSRCS += nsh_test.c
endif
+
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
diff --git a/apps/nshlib/nsh.h b/apps/nshlib/nsh.h
index 6f499a749..fd265982f 100644
--- a/apps/nshlib/nsh.h
+++ b/apps/nshlib/nsh.h
@@ -379,6 +379,12 @@ extern int cmd_test(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
extern int cmd_lbracket(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
+#ifndef CONFIG_DISABLE_CLOCK
+# if defined (CONFIG_RTC) && !defined(CONFIG_NSH_DISABLE_DATE)
+extern int cmd_date(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
+# endif
+#endif
+
#if CONFIG_NFILE_DESCRIPTORS > 0
# ifndef CONFIG_NSH_DISABLE_CAT
extern int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c
index 82fd01ee4..a193ebc9e 100644
--- a/apps/nshlib/nsh_parse.c
+++ b/apps/nshlib/nsh_parse.c
@@ -158,6 +158,10 @@ static const struct cmdmap_s g_cmdmap[] =
# endif
#endif
+#if defined (CONFIG_RTC) && !defined(CONFIG_DISABLE_CLOCK) && !defined(CONFIG_NSH_DISABLE_DATE)
+ { "date", cmd_date, 1, 3, "[-s \"MMM DD HH:MM:SS YYYY\"]" },
+#endif
+
#if CONFIG_NFILE_DESCRIPTORS > 0
# ifndef CONFIG_NSH_DISABLE_DD
{ "dd", cmd_dd, 3, 6, "if=<infile> of=<outfile> [bs=<sectsize>] [count=<sectors>] [skip=<sectors>]" },
diff --git a/apps/nshlib/nsh_timcmds.c b/apps/nshlib/nsh_timcmds.c
new file mode 100644
index 000000000..bf5e6cd5d
--- /dev/null
+++ b/apps/nshlib/nsh_timcmds.c
@@ -0,0 +1,330 @@
+/****************************************************************************
+ * apps/nshlib/dbg_timcmds.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <time.h>
+
+#include "nsh.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+#define MAX_TIME_STRING 80
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#if defined (CONFIG_RTC) && !defined(CONFIG_DISABLE_CLOCK) && !defined(CONFIG_NSH_DISABLE_DATE)
+static FAR const char * const g_datemontab[] =
+{
+ "jan", "feb", "mar", "apr", "may", "jun",
+ "jul", "aug", "sep", "oct", "nov", "dec"
+};
+#endif
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: date_month
+ ****************************************************************************/
+
+#if defined (CONFIG_RTC) && !defined(CONFIG_DISABLE_CLOCK) && !defined(CONFIG_NSH_DISABLE_DATE)
+static inline int date_month(FAR const char *abbrev)
+{
+ int i;
+
+ for (i = 0; i < 12; i++)
+ {
+ if (strncasecmp(g_datemontab[i], abbrev, 3) == 0)
+ {
+ return i;
+ }
+ }
+ return ERROR;
+}
+#endif
+
+/****************************************************************************
+ * Name: date_gettime
+ ****************************************************************************/
+
+#if defined (CONFIG_RTC) && !defined(CONFIG_DISABLE_CLOCK) && !defined(CONFIG_NSH_DISABLE_DATE)
+static inline int date_showtime(FAR struct nsh_vtbl_s *vtbl, FAR const char *name)
+{
+ static const char format[] = "%b %d %H:%M:%S %Y";
+ struct timespec ts;
+ struct tm tm;
+ char timbuf[MAX_TIME_STRING];
+ int ret;
+
+ /* Get the current time */
+
+ ret = clock_gettime(CLOCK_REALTIME, &ts);
+ if (ret < 0)
+ {
+ nsh_output(vtbl, g_fmtcmdfailed, name, "clock_gettime", NSH_ERRNO);
+ return ERROR;
+ }
+
+ /* Break the current time up into the format needed by strftime */
+
+ (void)gmtime_r((FAR const time_t*)ts.tv_sec, &tm);
+
+ /* Show the current time in the requested format */
+
+ (void)strftime(timbuf, MAX_TIME_STRING, format, &tm);
+ nsh_output(vtbl, "%s\n", timbuf);
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Name: date_settime
+ ****************************************************************************/
+
+#if defined (CONFIG_RTC) && !defined(CONFIG_DISABLE_CLOCK) && !defined(CONFIG_NSH_DISABLE_DATE)
+static inline int date_settime(FAR struct nsh_vtbl_s *vtbl, FAR const char *name,
+ FAR char *newtime)
+{
+ struct timespec ts;
+ struct tm tm;
+ FAR char *token;
+ FAR char *saveptr;
+ long result;
+ int ret;
+
+ /* Only this date format is supported: MMM DD HH:MM:SS YYYY */
+ /* Get the month abbreviation */
+
+ token = strtok_r(newtime, " \t",&saveptr);
+ if (token == NULL)
+ {
+ goto errout_bad_parm;
+ }
+
+ tm.tm_mon = date_month(token);
+ if (tm.tm_mon < 0)
+ {
+ goto errout_bad_parm;
+ }
+
+ /* Get the day of the month. NOTE: Accepts day-of-month up to 31 for all months */
+
+ token = strtok_r(newtime, " \t",&saveptr);
+ if (token == NULL)
+ {
+ goto errout_bad_parm;
+ }
+
+ result = strtol(token, NULL, 10);
+ if (result < 1 || result > 31)
+ {
+ goto errout_bad_parm;
+ }
+ tm.tm_mday = (int)result;
+
+ /* Get the hours */
+
+ token = strtok_r(NULL, " \t:", &saveptr);
+ if (token == NULL)
+ {
+ goto errout_bad_parm;
+ }
+
+ result = strtol(token, NULL, 10);
+ if (result < 0 || result > 23)
+ {
+ goto errout_bad_parm;
+ }
+ tm.tm_hour = (int)result;
+
+ /* Get the minutes */
+
+ token = strtok_r(NULL, " \t:", &saveptr);
+ if (token == NULL)
+ {
+ goto errout_bad_parm;
+ }
+
+ result = strtol(token, NULL, 10);
+ if (result < 0 || result > 59)
+ {
+ goto errout_bad_parm;
+ }
+ tm.tm_min = (int)result;
+
+ /* Get the seconds */
+
+ token = strtok_r(NULL, " \t:", &saveptr);
+ if (token == NULL)
+ {
+ goto errout_bad_parm;
+ }
+
+ result = strtol(token, NULL, 10);
+ if (result < 0 || result > 61)
+ {
+ goto errout_bad_parm;
+ }
+ tm.tm_sec = (int)result;
+
+ /* And finally the year */
+
+ token = strtok_r(NULL, " \t", &saveptr);
+ if (token == NULL)
+ {
+ goto errout_bad_parm;
+ }
+
+ result = strtol(token, NULL, 10);
+ if (result < 1900 || result > 2100)
+ {
+ goto errout_bad_parm;
+ }
+ tm.tm_year = (int)result;
+
+ /* Convert this to the right form, then set the timer */
+
+ ts.tv_sec = mktime(&tm);
+ ts.tv_nsec = 0;
+
+ ret = clock_settime(CLOCK_REALTIME, &ts);
+ if (ret < 0)
+ {
+ nsh_output(vtbl, g_fmtcmdfailed, name, "clock_settime", NSH_ERRNO);
+ return ERROR;
+ }
+ return OK;
+
+errout_bad_parm:
+ nsh_output(vtbl, g_fmtarginvalid, name);
+ return ERROR;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: cmd_date
+ ****************************************************************************/
+
+#if defined (CONFIG_RTC) && !defined(CONFIG_DISABLE_CLOCK) && !defined(CONFIG_NSH_DISABLE_DATE)
+int cmd_date(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
+{
+ FAR char *newtime = NULL;
+ FAR const char *errfmt;
+ bool badarg = false;
+ int option;
+ int ret;
+
+ /* Get the date options: date [-s time] [+FORMAT] */
+
+ while ((option = getopt(argc, argv, "s:")) != ERROR)
+ {
+ if (option == 's')
+ {
+ /* We will be setting the time */
+
+ newtime = optarg;
+ }
+ else /* option = '?' */
+ {
+ /* We need to parse to the end anyway so that getopt stays healthy */
+
+ badarg = true;
+ }
+ }
+
+ /* If a bad argument was encountered then exit with an error */
+
+ if (badarg)
+ {
+ errfmt = g_fmtarginvalid;
+ goto errout;
+ }
+
+ /* optind < argc-1 means that there are additional, unexpected arguments on
+ * th command-line
+ */
+
+ if (optind < argc)
+ {
+ errfmt = g_fmttoomanyargs;
+ goto errout;
+ }
+
+ /* Display or set the time */
+
+ if (newtime)
+ {
+ ret = date_settime(vtbl, argv[0], newtime);
+ }
+ else
+ {
+ ret = date_showtime(vtbl, argv[0]);
+ }
+ return ret;
+
+errout:
+ nsh_output(vtbl, errfmt, argv[0]);
+ return ERROR;
+}
+#endif
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index 383e7d6a7..4e603e0d0 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/Documentation/NuttX.html
@@ -1377,6 +1377,8 @@
</li>
<li>
Support for the NetClamps VSN was included in version 5.18 of NuttX.
+ Uros Platise added support for timers, RTC, I2C, FLASH, extended power management
+ and other features.
</li>
</ul>
<p>
diff --git a/nuttx/arch/arm/src/stm32/stm32_rtc.c b/nuttx/arch/arm/src/stm32/stm32_rtc.c
index 17b611008..68c4bc30d 100644
--- a/nuttx/arch/arm/src/stm32/stm32_rtc.c
+++ b/nuttx/arch/arm/src/stm32/stm32_rtc.c
@@ -222,11 +222,12 @@ clock_t up_rtc_getclock(void)
*
* \param time The unit depends on the prescaler value
**/
-void up_rtc_setclock(clock_t clock)
+
+void up_rtc_setclock(clock_t newclock)
{
stm32_rtc_beginwr();
- putreg16(clock >> 16, STM32_RTC_CNTH);
- putreg16(clock & 0xFFFF, STM32_RTC_CNTL);
+ putreg16(newclock >> 16, STM32_RTC_CNTH);
+ putreg16(newclock & 0xFFFF, STM32_RTC_CNTL);
stm32_rtc_endwr();
}
@@ -263,14 +264,14 @@ time_t up_rtc_gettime(void)
}
-void up_rtc_settime(time_t time)
+void up_rtc_settime(time_t newtime)
{
/* Do reverse compared to gettime above */
- uint32_t time_lsb = time << RTC_CLOCKS_SHIFT |
+ uint32_t time_lsb = newtime << RTC_CLOCKS_SHIFT |
(up_rtc_getclock() & ((1<<RTC_CLOCKS_SHIFT)-1));
- uint32_t time_msb = time >> (32-RTC_CLOCKS_SHIFT);
+ uint32_t time_msb = newtime >> (32-RTC_CLOCKS_SHIFT);
irqstate_t irqs = irqsave();
diff --git a/nuttx/configs/vsn/nsh/defconfig b/nuttx/configs/vsn/nsh/defconfig
index 1b979ad16..06da39faa 100755
--- a/nuttx/configs/vsn/nsh/defconfig
+++ b/nuttx/configs/vsn/nsh/defconfig
@@ -398,9 +398,9 @@ CONFIG_ARCH_LOWPUTC=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_INSTRUMENTATION=n
CONFIG_TASK_NAME_SIZE=16
-CONFIG_START_YEAR=2009
-CONFIG_START_MONTH=9
-CONFIG_START_DAY=21
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=8
+CONFIG_START_DAY=23
CONFIG_GREGORIAN_TIME=n
CONFIG_JULIAN_TIME=n
CONFIG_DEV_CONSOLE=y
diff --git a/nuttx/include/nuttx/pm.h b/nuttx/include/nuttx/pm.h
index f40bca61f..184f00e9c 100644
--- a/nuttx/include/nuttx/pm.h
+++ b/nuttx/include/nuttx/pm.h
@@ -33,6 +33,27 @@
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
+/* Definition of terms. Various "sleep" and low power consumption states
+ * have various names and are sometimes used in conflicting ways. In the
+ * PM logic, we will use the following terminology:
+ *
+ * NORMAL - The normal, full power operating mode.
+ * REDUCED - This is still basically normal operational mode, but with some
+ * simple changes to reduce power consumption. Perhaps this just
+ * means just dimming the backlight.
+ * STANDBY - Standby is a very low power consumption mode. It is the lowest
+ * power from which the system can recover quickly.
+ * SLEEP - The lowest power consumption mode. It may require some time
+ * to get back to normal operation from SLEEP (some parts may
+ * even require going through reset).
+ *
+ * State changes always proceed from higher to lower power usage:
+ *
+ * NORMAL->REDUCED->STANDBY->SLEEP
+ * ^ | | |
+ * | V V V
+ * +-------+---------+--------+
+ */
#ifndef __INCLUDE_NUTTX_PM_H
#define __INCLUDE_NUTTX_PM_H
@@ -42,11 +63,30 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <nuttx/fs.h>
+
+#ifdef CONFIG_PM
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
+/* Configuration ************************************************************/
+/* Time slices */
+
+#ifndef CONFIG_PM_SLICEMS
+# define CONFIG_PM_SLICEMS 100 /* Default is 100 msec */
+#endif
+
+#ifndef CONFIG_PM_NREDUCED
+# define CONFIG_PM_NREDUCED 30 /* Thiry IDLE slices to enter reduced mode */
+#endif
+
+#ifndef CONFIG_PM_NSTANDBY
+# define CONFIG_PM_NSTANDBY 80 /* Eight IDLE slices to enter standby mode */
+#endif
+
+#ifndef CONFIG_PM_NSLEEP
+# define CONFIG_PM_NSLEEP 150 /* 150 IDLE slices to enter standby mode */
+#endif
/****************************************************************************
* Public Types
@@ -56,33 +96,31 @@
* state indication is the state transition event.
*/
-enum pm_event_e
+enum pm_state_e
{
- PM_IDLE = 0, /* Drivers will receive periodic idle indications. The driver
- * may use these IDLE indications to perform driver-specific
- * power optimizations.
- */
- PM_SLEEP_PREP, /* This is a warning that the system is about to enter into
- * sleep mode. The driver should begin whatever operations
- * that may be required to enter sleep mode. The driver
- * may abort the sleep mode by returning a non-zero value
- * from the callback function.
- */
- PM_STOP_PREP, /* This is a warning that the system is about to enter into
- * stop mode. The driver should begin whatever operations
- * that may be required to enter stop mode. The driver
- * may abort the stop mode by returning a non-zero value
- * from the callback function.
- */
- PM_SLEEP, /* The system is entering sleep mode. The driver should
- * already be prepared for this mode.
- */
- PM_STOP, /* The system is entering stop mode. The driver should
- * already be prepared for this mode.
- */
- PM_RESUME, /* The system resuming normal operation. The driver should
- * reinitialize for normal operation.
- */
+ PM_REDUCED = 0, /* Drivers will receive periodic this indications if it is
+ * appropriate to enter a simple reduced power state. This
+ * would include simple things such as displaying display back-
+ * lighting. The driver should essentially be ready to resume
+ * normal activity instantly.
+ *
+ * PM_REDUCED may be followed by PM_STANDBY or PM_RESUME.
+ */
+ PM_STANDBY, /* The system is entering standby mode. The driver should
+ * already be prepared for this mode.
+ *
+ * PM_STANDBY may be followed PM_SLEEP or by PM_RESUME
+ */
+ PM_SLEEP, /* The system is entering deep sleep mode. The driver should
+ * already be prepared for this mode.
+ *
+ * PM_SLEEP may be following by PM_RESUME
+ */
+ PM_RESUME, /* The system is resuming normal operation. The driver should
+ * reinitialize for normal operation.
+ *
+ * PM_RESUME may be followed by PM_REDUCED.
+ */
}
/* This structure contain pointers callback functions in the driver. These
@@ -93,7 +131,53 @@ enum pm_event_e
struct pm_callback_s
{
struct pm_callback_s *flink; /* Supports a singly linked list */
- int (*notify)(enum pm_event_e pmevent); /* PM event callback */
+
+ /**************************************************************************
+ * Name: prepare
+ *
+ * Description:
+ * Notify the driver to prepare for a new power confition .This is a
+ * warning that the system is about to enter into a new power state. The
+ * driver should begin whatever operations that may be required to enter
+ * power state. The driver may abort the state change mode by returning
+ * a non-zero value from the callback function
+ *
+ * Input Parameters:
+ * cb - Returned to the driver. The driver version of the callback
+ * strucure may include additional, driver-specific state
+ * data at the end of the structure.
+ * pmstate - Idenfifies the new PM state
+ *
+ * Returned Value:
+ * 0 (OK) means the event was successfully processed. Non-zero means
+ * means that the driver is not prepared to perform the tasks needed
+ * achieve this power setting.
+ *
+ **************************************************************************/
+
+ int (*prepare)(FAR struct pm_callback_s *cb, enum pm_state_e pmstate);
+
+ /**************************************************************************
+ * Name: notify
+ *
+ * Description:
+ * Notify the driver of new power state. This callback is called after
+ * all drivers have had the opportunity to prepare for the new power
+ * state.
+ *
+ * Input Parameters:
+ * cb - Returned to the driver. The driver version of the callback
+ * strucure may include additional, driver-specific state
+ * data at the end of the structure.
+ * pmstate - Idenfifies the new PM state
+ *
+ * Returned Value:
+ * 0 (OK) means the event was successfully processed. Non-zero means
+ * means that the driver failed to enter the power mode.
+ *
+ **************************************************************************/
+
+ int (*notify)(FAR struct pm_callback_s *cb, enum pm_state_e pmstate);
}
/****************************************************************************
@@ -128,29 +212,41 @@ extern "C" {
*
****************************************************************************/
-EXTERN int pm_register(FAR const struct pm_callback_s *callbacks);
+EXTERN int pm_register(FAR struct pm_callback_s *callbacks);
/****************************************************************************
- * Name: pm_broadcast
+ * Name: pm_changestate
*
* Description:
* This function is used to platform-specific power managmeent logic. It
- * will announce the power management event to all drivers that have
- * registered for power management event callbacks.
+ * will announce the power management power management state change to all
+ * drivers that have registered for power management event callbacks.
*
- *
+ * Input Parameters:
+ * pmstate - Idenfifies the new PM state
+ *
+ * Returned Value:
+ * 0 (OK) means that the callback function for all registered drivers
+ * returned OK (meaning that they accept the state change).
*
****************************************************************************/
-EXTERN int pm_broadcast(enum pm_event_s pmevent);
+EXTERN int pm_changestate(enum pm_event_s pmstate);
/****************************************************************************
* Name: pm_activity
*
* Description:
* This function is called by a device driver to indicate that it is
- * performing meaningful activities (non-idle). This will restart a
- * idle timer and prevent entering reduced power states.
+ * performing meaningful activities (non-idle). This increment an activty
+ * cound and/or will restart a idle timer and prevent entering reduced
+ * power states.
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * The current activity count.
*
****************************************************************************/
@@ -164,6 +260,12 @@ EXTERN int pm_activity(void);
* was called. A count of zero will indicate that no meaningful activity
* occurred since the last time this function was called.
*
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * The current activity count.
+ *
****************************************************************************/
EXTERN int pm_checkactivity(void);
@@ -174,4 +276,5 @@ EXTERN int pm_checkactivity(void);
#endif
#endif /* __ASSEMBLY__ */
+#endif /* CONFIG_PM */
#endif /* __INCLUDE_NUTTX_PM_H */