summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-04-12 07:18:05 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-07-12 14:01:24 +0200
commitea4b0ff97428553ef89b02632d36bc3f582b214b (patch)
tree02fdf639c53f92bba5979e0def6f793093dbc7cc
parent16e8e2d8e32bd86f84d9cc028e30b25a5e579e13 (diff)
validation: Add ClockTick() support function
-rw-r--r--testsuites/validation/tx-support.c31
-rw-r--r--testsuites/validation/tx-support.h2
2 files changed, 30 insertions, 3 deletions
diff --git a/testsuites/validation/tx-support.c b/testsuites/validation/tx-support.c
index 0a4a9b6c9a..9119d0f652 100644
--- a/testsuites/validation/tx-support.c
+++ b/testsuites/validation/tx-support.c
@@ -5,9 +5,9 @@
*
* @ingroup RTEMSTestSuites
*
- * @brief This source file contains the definition of DeleteTask(),
- * DoCreateTask(), GetMode(), GetPriority(), GetSelfPriority(), GetThread(),
- * ReceiveAnyEvents(), RestoreRunnerASR(), RestoreRunnerMode(),
+ * @brief This source file contains the definition of ClockTick(),
+ * DeleteTask(), DoCreateTask(), GetMode(), GetPriority(), GetSelfPriority(),
+ * GetThread(), ReceiveAnyEvents(), RestoreRunnerASR(), RestoreRunnerMode(),
* RestoreRunnerPriority(), SendEvents(), SetMode(), SetSelfPriority(),
* SetPriority(), and StartTask().
*/
@@ -44,7 +44,11 @@
#include "tx-support.h"
#include <rtems/test.h>
+#include <rtems/score/percpu.h>
+#include <rtems/score/smpimpl.h>
+#include <rtems/score/threaddispatch.h>
#include <rtems/score/threadimpl.h>
+#include <rtems/score/watchdogimpl.h>
rtems_id DoCreateTask( rtems_name name, rtems_task_priority priority )
{
@@ -180,3 +184,24 @@ Thread_Control *GetThread( rtems_id id )
_ISR_lock_ISR_enable( &lock_context);
return the_thread;
}
+
+#if defined( RTEMS_SMP )
+static void DoWatchdogTick( void *arg )
+{
+ (void) arg;
+ _Watchdog_Tick( _Per_CPU_Get() );
+}
+#endif
+
+void ClockTick( void )
+{
+ Per_CPU_Control *cpu_self;
+
+ cpu_self = _Thread_Dispatch_disable();
+#if defined( RTEMS_SMP )
+ _SMP_Broadcast_action( DoWatchdogTick, NULL );
+#else
+ _Watchdog_Tick( cpu_self );
+#endif
+ _Thread_Dispatch_enable( cpu_self );
+}
diff --git a/testsuites/validation/tx-support.h b/testsuites/validation/tx-support.h
index 05b9a2347c..32f02564ba 100644
--- a/testsuites/validation/tx-support.h
+++ b/testsuites/validation/tx-support.h
@@ -105,6 +105,8 @@ struct _Thread_Control;
struct _Thread_Control *GetThread( rtems_id id );
+void ClockTick( void );
+
/**
* @brief Fails a dynamic memory allocation when the counter reaches zero.
*