source: rtems/cpukit/score/src/coretodset.c @ 03b900d

5
Last change on this file since 03b900d was 03b900d, checked in by Sebastian Huber <sebastian.huber@…>, on 02/18/16 at 07:36:26

score: Replace watchdog handler implementation

Use a red-black tree instead of delta chains.

Close #2344.
Update #2554.
Update #2555.
Close #2606.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * @file
3 *
4 * @brief Set Time of Day Given a Timestamp
5 *
6 * @ingroup ScoreTOD
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/score/todimpl.h>
22#include <rtems/score/threaddispatch.h>
23#include <rtems/score/watchdogimpl.h>
24
25void _TOD_Set_with_timestamp(
26  const Timestamp_Control *tod_as_timestamp
27)
28{
29  struct timespec tod_as_timespec;
30  uint64_t        tod_as_ticks;
31  uint32_t        cpu_count;
32  uint32_t        cpu_index;
33
34  _Timestamp_To_timespec( tod_as_timestamp, &tod_as_timespec );
35
36  _Thread_Disable_dispatch();
37
38  _Timecounter_Set_clock( &tod_as_timespec );
39
40  tod_as_ticks = _Watchdog_Ticks_from_timespec( &tod_as_timespec );
41  cpu_count = _SMP_Get_processor_count();
42
43  for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
44    Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
45
46    _Watchdog_Per_CPU_tickle_absolute( cpu, tod_as_ticks );
47  }
48
49  _TOD.is_set = true;
50
51  _Thread_Enable_dispatch();
52}
Note: See TracBrowser for help on using the repository browser.