source: rtems/cpukit/rtems/src/timerreset.c @ 66cb142

Last change on this file since 66cb142 was 9480815a, checked in by Sebastian Huber <sebastian.huber@…>, on Dec 21, 2017 at 1:36:52 PM

score: Introduce new monotonic clock

Rename PER_CPU_WATCHDOG_MONOTONIC to PER_CPU_WATCHDOG_TICKS. Add new
PER_CPU_WATCHDOG_MONOTONIC which is based on the system uptime (measured
by timecounter).

Close #3264.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * @file
3 *
4 * @brief RTEMS Timer Reset
5 * @ingroup ClassicTimer Timers
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/rtems/timerimpl.h>
22
23rtems_status_code rtems_timer_reset(
24  rtems_id id
25)
26{
27  Timer_Control    *the_timer;
28  ISR_lock_Context  lock_context;
29
30  the_timer = _Timer_Get( id, &lock_context );
31  if ( the_timer != NULL ) {
32    Per_CPU_Control   *cpu;
33    rtems_status_code  status;
34
35    cpu = _Timer_Acquire_critical( the_timer, &lock_context );
36
37    if ( _Timer_Is_interval_class( the_timer->the_class ) ) {
38      _Timer_Cancel( cpu, the_timer );
39      _Watchdog_Insert(
40        &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_TICKS ],
41        &the_timer->Ticker,
42        cpu->Watchdog.ticks + the_timer->initial
43      );
44      status = RTEMS_SUCCESSFUL;
45    } else {
46      status = RTEMS_NOT_DEFINED;
47    }
48
49    _Timer_Release( cpu, &lock_context );
50    return status;
51  }
52
53  return RTEMS_INVALID_ID;
54}
Note: See TracBrowser for help on using the repository browser.