summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-05-12 10:55:49 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-07-12 14:01:24 +0200
commitbb2ee6c34011491fed5571bf77a3e01768434e2e (patch)
tree908476cfb70f2c09edaa77e55bd07106e0f11385
parent503138c62af8747f946cd0b3d6732ccd56119201 (diff)
tx-support
-rw-r--r--testsuites/validation/tx-support.c44
-rw-r--r--testsuites/validation/tx-support.h8
2 files changed, 52 insertions, 0 deletions
diff --git a/testsuites/validation/tx-support.c b/testsuites/validation/tx-support.c
index 2601e46f16..2820a8c6d1 100644
--- a/testsuites/validation/tx-support.c
+++ b/testsuites/validation/tx-support.c
@@ -283,6 +283,50 @@ void Yield( void )
T_quiet_rsc_success( sc );
}
+rtems_id CreateMutex( 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 | RTEMS_INHERIT_PRIORITY,
+ 0,
+ &id
+ );
+ T_rsc_success( sc );
+
+ return id;
+}
+
+void DeleteMutex( rtems_id id )
+{
+ if ( id != INVALID_ID ) {
+ rtems_status_code sc;
+
+ sc = rtems_semaphore_delete( id );
+ T_rsc_success( sc );
+ }
+}
+
+void ObtainMutex( rtems_id id )
+{
+ rtems_status_code sc;
+
+ sc = rtems_semaphore_obtain( id, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
+ T_rsc_success( sc );
+}
+
+void ReleaseMutex( rtems_id id )
+{
+ rtems_status_code sc;
+
+ sc = rtems_semaphore_release( id );
+ T_rsc_success( sc );
+}
+
void RestoreRunnerASR( void )
{
rtems_status_code sc;
diff --git a/testsuites/validation/tx-support.h b/testsuites/validation/tx-support.h
index 3cc28dcfa0..530606dc34 100644
--- a/testsuites/validation/tx-support.h
+++ b/testsuites/validation/tx-support.h
@@ -147,6 +147,14 @@ void SetSelfAffinityAll( void );
void Yield( void );
+rtems_id CreateMutex( void );
+
+void DeleteMutex( rtems_id id );
+
+void ObtainMutex( rtems_id id );
+
+void ReleaseMutex( rtems_id id );
+
void RestoreRunnerASR( void );
void RestoreRunnerMode( void );