From bb2ee6c34011491fed5571bf77a3e01768434e2e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 12 May 2021 10:55:49 +0200 Subject: tx-support --- testsuites/validation/tx-support.c | 44 ++++++++++++++++++++++++++++++++++++++ testsuites/validation/tx-support.h | 8 +++++++ 2 files changed, 52 insertions(+) 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 ); -- cgit v1.2.3