summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-06-29 15:37:32 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-07-12 14:01:24 +0200
commit4edd4ef2045867b276a3202cbda82be4defab4ed (patch)
treeaf8b1617e43ad0f29e352b847c8b251fc9ff32ed
parent5d23a2f2fcaa27f97474fcfed06e798c5d59056e (diff)
tx-support
-rw-r--r--testsuites/validation/tx-support.c56
-rw-r--r--testsuites/validation/tx-support.h27
2 files changed, 78 insertions, 5 deletions
diff --git a/testsuites/validation/tx-support.c b/testsuites/validation/tx-support.c
index 9c84deeca3..dfb1f8804b 100644
--- a/testsuites/validation/tx-support.c
+++ b/testsuites/validation/tx-support.c
@@ -45,7 +45,8 @@
#include <rtems/score/smpimpl.h>
#include <rtems/score/threaddispatch.h>
#include <rtems/score/threadimpl.h>
-#include <rtems/score/watchdogimpl.h>
+
+#include <string.h>
rtems_id DoCreateTask( rtems_name name, rtems_task_priority priority )
{
@@ -106,6 +107,11 @@ void ResumeTask( rtems_id id )
rtems_event_set ReceiveAnyEvents( void )
{
+ return ReceiveAnyEventsTimed( RTEMS_NO_TIMEOUT );
+}
+
+rtems_event_set ReceiveAnyEventsTimed( rtems_interval ticks )
+{
rtems_status_code sc;
rtems_event_set events;
@@ -113,7 +119,7 @@ rtems_event_set ReceiveAnyEvents( void )
sc = rtems_event_receive(
RTEMS_ALL_EVENTS,
RTEMS_EVENT_ANY | RTEMS_WAIT,
- RTEMS_NO_TIMEOUT,
+ ticks,
&events
);
T_quiet_rsc_success( sc );
@@ -301,6 +307,24 @@ rtems_id CreateMutex( void )
return id;
}
+rtems_id CreateMutexNoProtocol( void )
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ id = INVALID_ID;
+ sc = rtems_semaphore_create(
+ rtems_build_name( 'M', 'U', 'T', 'X' ),
+ 1,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY,
+ 0,
+ &id
+ );
+ T_rsc_success( sc );
+
+ return id;
+}
+
void DeleteMutex( rtems_id id )
{
if ( id != INVALID_ID ) {
@@ -319,6 +343,14 @@ void ObtainMutex( rtems_id id )
T_rsc_success( sc );
}
+void ObtainMutexTimed( rtems_id id, rtems_interval ticks )
+{
+ rtems_status_code sc;
+
+ sc = rtems_semaphore_obtain( id, RTEMS_WAIT, ticks );
+ T_rsc_success( sc );
+}
+
void ReleaseMutex( rtems_id id )
{
rtems_status_code sc;
@@ -382,14 +414,18 @@ void WaitForExecutionStop( rtems_id task_id )
void GetTaskTimerInfo( rtems_id id, TaskTimerInfo *info )
{
- Thread_Control *thread;
+ GetTaskTimerInfoByThread( GetThread( id ), info );
+}
+void GetTaskTimerInfoByThread(
+ struct _Thread_Control *thread,
+ TaskTimerInfo *info
+)
+{
info->expire_ticks = 0;
info->expire_timespec.tv_sec = -1;
info->expire_timespec.tv_nsec = -1;
- thread = GetThread( id );
-
if ( thread != NULL ) {
ISR_lock_Context lock_context;
ISR_lock_Context lock_context_2;
@@ -551,3 +587,13 @@ void SetFatalExtension( rtems_fatal_extension fatal )
{
fatal_extension = fatal;
}
+
+void ClearExtensionCalls( ExtensionCalls *calls )
+{
+ memset( calls, 0, sizeof( *calls ) );
+}
+
+void CopyExtensionCalls( const ExtensionCalls *from, ExtensionCalls *to )
+{
+ memcpy( to, from, sizeof( *to ) );
+}
diff --git a/testsuites/validation/tx-support.h b/testsuites/validation/tx-support.h
index bf2027d20c..14526b4843 100644
--- a/testsuites/validation/tx-support.h
+++ b/testsuites/validation/tx-support.h
@@ -101,6 +101,8 @@ void ResumeTask( rtems_id id );
rtems_event_set ReceiveAnyEvents( void );
+rtems_event_set ReceiveAnyEventsTimed( rtems_interval ticks );
+
void ReceiveAllEvents( rtems_event_set events );
void SendEvents( rtems_id id, rtems_event_set events );
@@ -149,10 +151,14 @@ void Yield( void );
rtems_id CreateMutex( void );
+rtems_id CreateMutexNoProtocol( void );
+
void DeleteMutex( rtems_id id );
void ObtainMutex( rtems_id id );
+void ObtainMutexTimed( rtems_id id, rtems_interval ticks );
+
void ReleaseMutex( rtems_id id );
void RestoreRunnerASR( void );
@@ -185,6 +191,11 @@ typedef struct {
void GetTaskTimerInfo( rtems_id id, TaskTimerInfo *info );
+void GetTaskTimerInfoByThread(
+ struct _Thread_Control *thread,
+ TaskTimerInfo *info
+);
+
void ClockTick( void );
/**
@@ -396,6 +407,22 @@ void FatalInitialExtension(
void SetFatalExtension( rtems_fatal_extension fatal );
+typedef struct {
+ uint32_t fatal;
+ uint32_t thread_begin;
+ uint32_t thread_create;
+ uint32_t thread_delete;
+ uint32_t thread_exitted;
+ uint32_t thread_restart;
+ uint32_t thread_start;
+ uint32_t thread_switch;
+ uint32_t thread_terminate;
+} ExtensionCalls;
+
+void ClearExtensionCalls( ExtensionCalls *calls );
+
+void CopyExtensionCalls( const ExtensionCalls *from, ExtensionCalls *to );
+
/** @} */
#ifdef __cplusplus