From c1acaba7d380120da5ee12fe7a3f309b59d83425 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 6 May 2021 08:56:05 +0200 Subject: tx-support --- testsuites/validation/tx-support.c | 95 ++++++++++++++++++++++++++++++++++++-- testsuites/validation/tx-support.h | 28 +++++++++++ 2 files changed, 118 insertions(+), 5 deletions(-) diff --git a/testsuites/validation/tx-support.c b/testsuites/validation/tx-support.c index 80be672c44..e39f849a17 100644 --- a/testsuites/validation/tx-support.c +++ b/testsuites/validation/tx-support.c @@ -5,11 +5,8 @@ * * @ingroup RTEMSTestSuites * - * @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(). + * @brief This source file contains the implementation of support functions for + * the validation test cases. */ /* @@ -169,6 +166,94 @@ rtems_task_priority SetSelfPriority( rtems_task_priority priority ) return SetPriority( RTEMS_SELF, priority ); } +rtems_id GetScheduler( rtems_id id ) +{ + rtems_status_code sc; + rtems_id scheduler_id; + + scheduler_id = 0xffffffff; + sc = rtems_task_get_scheduler( id, &scheduler_id ); + T_rsc_success( sc ); + + return scheduler_id; +} + +rtems_id GetSelfScheduler( void ) +{ + return GetScheduler( RTEMS_SELF ); +} + +void SetScheduler( + rtems_id task_id, + rtems_id scheduler_id, + rtems_task_priority priority +) +{ + rtems_status_code sc; + + sc = rtems_task_set_scheduler( task_id, scheduler_id, priority ); + T_rsc_success( sc ); +} + +void SetSelfScheduler( rtems_id scheduler_id, rtems_task_priority priority ) +{ + SetScheduler( RTEMS_SELF, scheduler_id, priority ); +} + +void GetAffinity( rtems_id id, cpu_set_t *set ) +{ + rtems_status_code sc; + + CPU_ZERO( set ); + sc = rtems_task_get_affinity( id, sizeof( *set ), set ); + T_rsc_success( sc ); +} + +void GetSelfAffinity( cpu_set_t *set ) +{ + GetAffinity( RTEMS_SELF, set ); +} + +void SetAffinity( rtems_id id, const cpu_set_t *set ) +{ + rtems_status_code sc; + + sc = rtems_task_set_affinity( id, sizeof( *set ), set ); + T_rsc_success( sc ); +} + +void SetSelfAffinity( const cpu_set_t *set ) +{ + SetAffinity( RTEMS_SELF, set ); +} + +void SetAffinityOne( rtems_id id, uint32_t cpu_index ) +{ + cpu_set_t set; + + CPU_ZERO( &set ); + CPU_SET( (int) cpu_index, &set ); + SetAffinity( id, &set ); +} + +void SetSelfAffinityOne( uint32_t cpu_index ) +{ + SetAffinityOne( RTEMS_SELF, cpu_index ); +} + +void SetAffinityAll( rtems_id id ) +{ + cpu_set_t set; + + CPU_FILL( &set ); + SetAffinity( id, &set ); +} + +void SetSelfAffinityAll( void ) +{ + SetAffinityAll( RTEMS_SELF ); +} + void Yield( void ) { rtems_status_code sc; diff --git a/testsuites/validation/tx-support.h b/testsuites/validation/tx-support.h index 5970153c3c..48559379e6 100644 --- a/testsuites/validation/tx-support.h +++ b/testsuites/validation/tx-support.h @@ -99,6 +99,34 @@ rtems_task_priority GetSelfPriority( void ); rtems_task_priority SetSelfPriority( rtems_task_priority priority ); +rtems_id GetScheduler( rtems_id id ); + +rtems_id GetSelfScheduler( void ); + +void SetScheduler( + rtems_id task_id, + rtems_id scheduler_id, + rtems_task_priority priority +); + +void SetSelfScheduler( rtems_id scheduler_id, rtems_task_priority priority ); + +void GetAffinity( rtems_id id, cpu_set_t *set ); + +void GetSelfAffinity( cpu_set_t *set ); + +void SetAffinity( rtems_id id, const cpu_set_t *set ); + +void SetSelfAffinity( const cpu_set_t *set ); + +void SetAffinityOne( rtems_id id, uint32_t cpu_index ); + +void SetSelfAffinityOne( uint32_t cpu_index ); + +void SetAffinityAll( rtems_id id ); + +void SetSelfAffinityAll( void ); + void Yield( void ); void RestoreRunnerASR( void ); -- cgit v1.2.3