source:
rtems/cpukit/score/src/coretodset.c
@
1ef8e4a8
Last change on this file since 1ef8e4a8 was 1ef8e4a8, checked in by Sebastian Huber <sebastian.huber@…>, on 04/27/16 at 20:07:56 | |
---|---|
|
|
File size: 1.2 KB |
Rev | Line | |
---|---|---|
[1b475860] | 1 | /** |
2 | * @file | |
3 | * | |
4 | * @brief Set Time of Day Given a Timestamp | |
5 | * | |
6 | * @ingroup ScoreTOD | |
[412dbff6] | 7 | */ |
8 | ||
9 | /* COPYRIGHT (c) 1989-2007. | |
[93b4e6ef] | 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 | |
[c499856] | 14 | * http://www.rtems.org/license/LICENSE. |
[93b4e6ef] | 15 | */ |
16 | ||
[a8eed23] | 17 | #if HAVE_CONFIG_H |
18 | #include "config.h" | |
19 | #endif | |
20 | ||
[f031df0e] | 21 | #include <rtems/score/todimpl.h> |
[1ef8e4a8] | 22 | #include <rtems/score/assert.h> |
[4b48ece0] | 23 | #include <rtems/score/watchdogimpl.h> |
[93b4e6ef] | 24 | |
[3888771] | 25 | void _TOD_Set( |
[1ef8e4a8] | 26 | const Timestamp_Control *tod_as_timestamp, |
27 | ISR_lock_Context *lock_context | |
[93b4e6ef] | 28 | ) |
29 | { | |
[03b900d] | 30 | struct timespec tod_as_timespec; |
31 | uint64_t tod_as_ticks; | |
32 | uint32_t cpu_count; | |
33 | uint32_t cpu_index; | |
[c16bcc0] | 34 | |
[1ef8e4a8] | 35 | _Assert( _API_Mutex_Is_owner( _Once_Mutex ) ); |
[93b4e6ef] | 36 | |
[1ef8e4a8] | 37 | _Timecounter_Set_clock( tod_as_timestamp, lock_context ); |
[a211a732] | 38 | |
[1ef8e4a8] | 39 | _Timestamp_To_timespec( tod_as_timestamp, &tod_as_timespec ); |
[03b900d] | 40 | tod_as_ticks = _Watchdog_Ticks_from_timespec( &tod_as_timespec ); |
41 | cpu_count = _SMP_Get_processor_count(); | |
[a211a732] | 42 | |
[03b900d] | 43 | for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) { |
44 | Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index ); | |
[c16bcc0] | 45 | |
[03b900d] | 46 | _Watchdog_Per_CPU_tickle_absolute( cpu, tod_as_ticks ); |
47 | } | |
[93b4e6ef] | 48 | |
[7cd2484] | 49 | _TOD.is_set = true; |
[93b4e6ef] | 50 | } |
Note: See TracBrowser
for help on using the repository browser.