2007-03-28 Chris Johns <chrisj@rtems.org>

* rtems/Makefile.am, rtems/include/rtems/rtems/clock.h,
	score/include/rtems/score/watchdog.h: Add support for a handler to
	obtain the number of nanoseconds since the last clock tick. The
	primary interface for this is rtems_clock_set_nanoseconds_extension.
	Subsequent commits from Joel will redo the TOD support to use this
	capability.
	* rtems/src/clocksetnsecshandler.c: New file.
This commit is contained in:
Joel Sherrill
2007-03-28 19:56:14 +00:00
parent a91cc066d5
commit 4b6546f0bb
5 changed files with 103 additions and 4 deletions

View File

@@ -1,3 +1,13 @@
2007-03-28 Chris Johns <chrisj@rtems.org>
* rtems/Makefile.am, rtems/include/rtems/rtems/clock.h,
score/include/rtems/score/watchdog.h: Add support for a handler to
obtain the number of nanoseconds since the last clock tick. The
primary interface for this is rtems_clock_set_nanoseconds_extension.
Subsequent commits from Joel will redo the TOD support to use this
capability.
* rtems/src/clocksetnsecshandler.c: New file.
2007-03-28 Joel Sherrill <joel@OARcorp.com>
PR 1234/cpukit

View File

@@ -77,7 +77,7 @@ librtems_a_SOURCES += src/barrier.c src/barriercreate.c src/barrierdelete.c \
## CLOCK_C_FILES
librtems_a_SOURCES += src/rtclock.c src/clockget.c src/clockset.c \
src/clocktick.c
src/clocktick.c src/clocksetnsecshandler.c
## TIMER_C_FILES
librtems_a_SOURCES += src/rtemstimer.c src/timercancel.c src/timercreate.c \

View File

@@ -11,10 +11,10 @@
*
* + set the current date and time
* + obtain the current date and time
* + set the nanoseconds since last clock tick handler
* + announce a clock tick
*
*
* COPYRIGHT (c) 1989-1999.
* COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -55,6 +55,12 @@ typedef struct {
uint32_t microseconds;
} rtems_clock_time_value;
/*
* Type for the nanoseconds since last tick BSP extension.
*/
typedef Watchdog_Nanoseconds_since_last_tick_routine
rtems_nanoseconds_extension_routine;
/*
* rtems_clock_get
*
@@ -97,6 +103,25 @@ rtems_status_code rtems_clock_set(
rtems_status_code rtems_clock_tick( void );
/*
* rtems_clock_set_nanoseconds_extension
*
* DESCRIPTION:
*
* This directive sets the BSP provided nanoseconds since last tick
* extension.
*
* Input parameters:
* routine - pointer to the extension routine
*
* Output parameters:
* RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful
*/
rtems_status_code rtems_clock_set_nanoseconds_extension(
rtems_nanoseconds_extension_routine routine
);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,49 @@
/*
* Clock Manager
*
* COPYRIGHT (c) 1989-2006.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/system.h>
#include <rtems/rtems/status.h>
#include <rtems/rtems/clock.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/score/watchdog.h>
/*PAGE
*
* rtems_clock_set_nanoseconds_extension
*
* This directive sets the BSP provided nanoseconds since last tick
* extension.
*
* Input parameters:
* routine - pointer to the extension routine
*
* Output parameters:
* RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful
*/
rtems_status_code rtems_clock_set_nanoseconds_extension(
rtems_nanoseconds_extension_routine routine
)
{
if ( !routine )
return RTEMS_INVALID_ADDRESS;
_Watchdog_Nanoseconds_since_tick_handler = routine;
return RTEMS_SUCCESSFUL;
}

View File

@@ -7,7 +7,7 @@
*/
/*
* COPYRIGHT (c) 1989-2006.
* COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -50,6 +50,13 @@ extern "C" {
*/
typedef uint32_t Watchdog_Interval;
/** @brief Watchdog Nanoseconds Since Last Tick Extension
*
* This type defines a pointer to the BSP plugin to obtain the number
* of nanoseconds since the last clock tick.
*/
typedef uint32_t (*Watchdog_Nanoseconds_since_last_tick_routine)(void);
/** @brief Watchdog Service Routine Return Type
*
* This type defines the return type from a Watchdog Service Routine.
@@ -158,6 +165,14 @@ SCORE_EXTERN volatile uint32_t _Watchdog_Sync_count;
SCORE_EXTERN volatile Watchdog_Interval _Watchdog_Ticks_since_boot;
/** @brief Watchdog Nanoseconds Since Last Tick Handler
*
* This is a pointer to the optional BSP plugin to obtain the number
* of nanoseconds since the last clock tick.
*/
SCORE_EXTERN Watchdog_Nanoseconds_since_last_tick_routine
_Watchdog_Nanoseconds_since_tick_handler;
/** @brief Per Ticks Watchdog List
*
* This is the watchdog chain which is managed at ticks.