summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-12 09:51:16 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-15 09:48:35 +0100
commitf8d32c543cdbfe056fcce13e5d6e59bba03b8ac7 (patch)
tree03138f903f8b13634ba911ae6b97f2a893b6ddcd
parent0149dbf5e5159bda623588b6fa75db6c8442aee5 (diff)
score: Pass CPU to _Watchdog_Tickle()
This is a preparation to pass the CPU also to the watchdog routine to allow a faster insert in watchdog routines. This is useful for periodic watchdogs.
-rw-r--r--cpukit/include/rtems/score/watchdogimpl.h14
-rw-r--r--cpukit/score/src/coretodset.c2
-rw-r--r--cpukit/score/src/watchdogtick.c16
-rw-r--r--testsuites/sptests/spwatchdog/init.c10
4 files changed, 15 insertions, 27 deletions
diff --git a/cpukit/include/rtems/score/watchdogimpl.h b/cpukit/include/rtems/score/watchdogimpl.h
index 5a024069ca..14a92cd42a 100644
--- a/cpukit/include/rtems/score/watchdogimpl.h
+++ b/cpukit/include/rtems/score/watchdogimpl.h
@@ -193,24 +193,14 @@ RTEMS_INLINE_ROUTINE void _Watchdog_Initialize(
the_watchdog->routine = routine;
}
-void _Watchdog_Do_tickle(
+void _Watchdog_Tickle(
+ Per_CPU_Control *cpu,
Watchdog_Header *header,
Watchdog_Control *first,
uint64_t now,
-#if defined(RTEMS_SMP)
- ISR_lock_Control *lock,
-#endif
ISR_lock_Context *lock_context
);
-#if defined(RTEMS_SMP)
- #define _Watchdog_Tickle( header, first, now, lock, lock_context ) \
- _Watchdog_Do_tickle( header, first, now, lock, lock_context )
-#else
- #define _Watchdog_Tickle( header, first, now, lock, lock_context ) \
- _Watchdog_Do_tickle( header, first, now, lock_context )
-#endif
-
/**
* @brief Inserts a watchdog into the set of scheduled watchdogs according to
* the specified expiration time.
diff --git a/cpukit/score/src/coretodset.c b/cpukit/score/src/coretodset.c
index 020b8878c0..205819601e 100644
--- a/cpukit/score/src/coretodset.c
+++ b/cpukit/score/src/coretodset.c
@@ -55,10 +55,10 @@ void _TOD_Set(
if ( first != NULL ) {
_Watchdog_Tickle(
+ cpu,
header,
first,
tod_as_ticks,
- &cpu->Watchdog.Lock,
&lock_context
);
}
diff --git a/cpukit/score/src/watchdogtick.c b/cpukit/score/src/watchdogtick.c
index 2f11357019..893f5a0fef 100644
--- a/cpukit/score/src/watchdogtick.c
+++ b/cpukit/score/src/watchdogtick.c
@@ -21,13 +21,11 @@
#include <rtems/score/threaddispatch.h>
#include <rtems/score/timecounter.h>
-void _Watchdog_Do_tickle(
+void _Watchdog_Tickle(
+ Per_CPU_Control *cpu,
Watchdog_Header *header,
Watchdog_Control *first,
uint64_t now,
-#ifdef RTEMS_SMP
- ISR_lock_Control *lock,
-#endif
ISR_lock_Context *lock_context
)
{
@@ -40,9 +38,9 @@ void _Watchdog_Do_tickle(
_Watchdog_Set_state( first, WATCHDOG_INACTIVE );
routine = first->routine;
- _ISR_lock_Release_and_ISR_enable( lock, lock_context );
+ _ISR_lock_Release_and_ISR_enable( &cpu->Watchdog.Lock, lock_context );
( *routine )( first );
- _ISR_lock_ISR_disable_and_acquire( lock, lock_context );
+ _ISR_lock_ISR_disable_and_acquire( &cpu->Watchdog.Lock, lock_context );
} else {
break;
}
@@ -75,10 +73,10 @@ void _Watchdog_Tick( Per_CPU_Control *cpu )
if ( first != NULL ) {
_Watchdog_Tickle(
+ cpu,
header,
first,
ticks,
- &cpu->Watchdog.Lock,
&lock_context
);
}
@@ -89,10 +87,10 @@ void _Watchdog_Tick( Per_CPU_Control *cpu )
if ( first != NULL ) {
_Timecounter_Getnanouptime( &now );
_Watchdog_Tickle(
+ cpu,
header,
first,
_Watchdog_Ticks_from_timespec( &now ),
- &cpu->Watchdog.Lock,
&lock_context
);
}
@@ -103,10 +101,10 @@ void _Watchdog_Tick( Per_CPU_Control *cpu )
if ( first != NULL ) {
_Timecounter_Getnanotime( &now );
_Watchdog_Tickle(
+ cpu,
header,
first,
_Watchdog_Ticks_from_timespec( &now ),
- &cpu->Watchdog.Lock,
&lock_context
);
}
diff --git a/testsuites/sptests/spwatchdog/init.c b/testsuites/sptests/spwatchdog/init.c
index 555d52d19f..998d317ae9 100644
--- a/testsuites/sptests/spwatchdog/init.c
+++ b/testsuites/sptests/spwatchdog/init.c
@@ -79,21 +79,21 @@ static void test_watchdog_init( test_watchdog *watchdog, int counter )
static uint64_t test_watchdog_tick( Watchdog_Header *header, uint64_t now )
{
- ISR_LOCK_DEFINE( , lock, "Test" )
+ Per_CPU_Control *cpu;
ISR_lock_Context lock_context;
Watchdog_Control *first;
- _ISR_lock_ISR_disable_and_acquire( &lock, &lock_context );
+ cpu = _Per_CPU_Get_snapshot();
+ _ISR_lock_ISR_disable_and_acquire( &cpu->Watchdog.Lock, &lock_context );
++now;
first = _Watchdog_Header_first( header );
if ( first != NULL ) {
- _Watchdog_Tickle( header, first, now, &lock, &lock_context );
+ _Watchdog_Tickle( cpu, header, first, now, &lock_context );
}
- _ISR_lock_Release_and_ISR_enable( &lock, &lock_context );
- _ISR_lock_Destroy( &lock );
+ _ISR_lock_Release_and_ISR_enable( &cpu->Watchdog.Lock, &lock_context );
return now;
}