From fd484c4de9f27c18c07feb5c03728b67de3922fb Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 22 Aug 2014 08:46:34 -0600 Subject: [PATCH] Add support for statically allocated watchdog timer structures --- Documentation/NuttxPortingGuide.html | 23 +++++----- include/nuttx/wdog.h | 67 +++++++++++++++++++++++++++- sched/wdog/wd_cancel.c | 14 +++--- sched/wdog/wd_create.c | 6 +-- sched/wdog/wd_delete.c | 6 ++- sched/wdog/wd_gettime.c | 4 +- sched/wdog/wd_initialize.c | 4 +- sched/wdog/wd_start.c | 44 +++++++++--------- sched/wdog/wdog.h | 52 --------------------- 9 files changed, 119 insertions(+), 101 deletions(-) diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index aaf1597c6d..011048d2a3 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -2705,33 +2705,35 @@ int up_timer_start(FAR const struct timespec *ts); or kill() to communicate with NuttX tasks.

-

4.3.5.1 wd_create

+

4.3.5.1 wd_create/wd_static

Function Prototype:

     #include <nuttx/wdog.h>
     WDOG_ID wd_create(void);
+    void wd_static(FAR struct wdog_s *wdog);
 

-Description: The wd_create function will create a watchdog -by allocating the appropriate resources for the watchdog. +Description: The wd_create() function will create a timer by allocating the appropriate resources for the watchdog. The wd_create() function returns a pointer to a fully initialized, dynamically allocated struct wdog_s instance (which is typedef'ed as WDOG_ID); +

+

+wd_static() performs the equivalent initialization of a statically allocated struct wdog_s instance. No allocation is performed in this case. The initializer definition, WDOG_INITIALIZER is also available for initialization of static instances of struct wdog_s. NOTE: wd_static() is also implemented as a macro definition. +

Input Parameters: None.

Returned Value:

@@ -2760,10 +2762,11 @@ initialization time).

-Description: The wd_delete function will deallocate a -watchdog. The watchdog will be removed from the timer queue if -has been started. +Description: The wd_delete function will deallocate a watchdog timer previously allocated via wd_create(). The watchdog timer will be removed from the timer queue if has been started.

+

+This function need not be called for statically allocated timers (but it is not harmful to do so). +

Input Parameters: