summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-09-28 11:04:38 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-11-09 15:47:11 +0100
commitbc97bd3b117df178eb205d30057025ee69764b54 (patch)
tree1366c1552bc0418552e9a6d9199054bb370aaf92
parent6476c46a2ad6447e038cf0012bf5619152a1153b (diff)
tx-support
-rw-r--r--testsuites/validation/ts-config.h20
-rw-r--r--testsuites/validation/ts-default.h26
-rw-r--r--testsuites/validation/tx-support.c23
-rw-r--r--testsuites/validation/tx-support.h22
-rw-r--r--testsuites/validation/tx-thread-queue.c37
-rw-r--r--testsuites/validation/tx-thread-queue.h19
6 files changed, 125 insertions, 22 deletions
diff --git a/testsuites/validation/ts-config.h b/testsuites/validation/ts-config.h
index adfadf6ad0..08df51fc02 100644
--- a/testsuites/validation/ts-config.h
+++ b/testsuites/validation/ts-config.h
@@ -65,8 +65,28 @@ extern "C" {
#define TEST_MINIMUM_STACK_SIZE ( 4 * RTEMS_MINIMUM_STACK_SIZE )
#endif
+#define TEST_MAXIMUM_BARRIERS 7
+
+#define TEST_MAXIMUM_MESSAGE_QUEUES 3
+
+#define TEST_MAXIMUM_PARTITIONS 4
+
+#define TEST_MAXIMUM_PERIODS 2
+
+#define TEST_MAXIMUM_SEMAPHORES 6
+
+#define TEST_MAXIMUM_TASKS 32
+
#define TEST_MAXIMUM_TIMERS 10
+#define TEST_MAXIMUM_USER_EXTENSIONS 5
+
+#define TEST_TICKS_PER_TIMESLICE 1
+
+void *test_task_stack_allocate( size_t size );
+
+void test_task_stack_deallocate( void *stack );
+
/** @} */
#ifdef __cplusplus
diff --git a/testsuites/validation/ts-default.h b/testsuites/validation/ts-default.h
index d1f2394091..d2c4ccb036 100644
--- a/testsuites/validation/ts-default.h
+++ b/testsuites/validation/ts-default.h
@@ -48,7 +48,7 @@
#define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT )
#endif
-#define MAX_TASKS 32
+#define MAX_TASKS ( TEST_MAXIMUM_TASKS - 1 )
#define TASK_ATTRIBUTES RTEMS_FLOATING_POINT
@@ -125,7 +125,7 @@ static void Init( rtems_task_argument arg )
rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, (uint32_t) exit_code );
}
-static void *task_stack_allocate( size_t size )
+void *test_task_stack_allocate( size_t size )
{
if ( size > sizeof( task_storage[ 0 ] ) ) {
return NULL;
@@ -134,7 +134,7 @@ static void *task_stack_allocate( size_t size )
return rtems_chain_get_unprotected( &free_task_storage );
}
-static void task_stack_deallocate( void *stack )
+void test_task_stack_deallocate( void *stack )
{
rtems_chain_append_unprotected(
&free_task_storage,
@@ -146,28 +146,28 @@ static void task_stack_deallocate( void *stack )
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#endif
-#define CONFIGURE_MAXIMUM_BARRIERS 3
+#define CONFIGURE_MAXIMUM_BARRIERS TEST_MAXIMUM_BARRIERS
-#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 3
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES TEST_MAXIMUM_MESSAGE_QUEUES
-#define CONFIGURE_MAXIMUM_PARTITIONS 3
+#define CONFIGURE_MAXIMUM_PARTITIONS TEST_MAXIMUM_PARTITIONS
-#define CONFIGURE_MAXIMUM_PERIODS 3
+#define CONFIGURE_MAXIMUM_PERIODS TEST_MAXIMUM_PERIODS
-#define CONFIGURE_MAXIMUM_SEMAPHORES 6
+#define CONFIGURE_MAXIMUM_SEMAPHORES TEST_MAXIMUM_SEMAPHORES
-#define CONFIGURE_MAXIMUM_TASKS ( 1 + MAX_TASKS )
+#define CONFIGURE_MAXIMUM_TASKS TEST_MAXIMUM_TASKS
#define CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE \
CONFIGURE_MAXIMUM_TASKS
#define CONFIGURE_MAXIMUM_TIMERS TEST_MAXIMUM_TIMERS
-#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 5
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS TEST_MAXIMUM_USER_EXTENSIONS
#define CONFIGURE_MICROSECONDS_PER_TICK TEST_MICROSECONDS_PER_TICK
-#define CONFIGURE_TICKS_PER_TIMESLICE 1
+#define CONFIGURE_TICKS_PER_TIMESLICE TEST_TICKS_PER_TIMESLICE
#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 0
@@ -179,9 +179,9 @@ static void task_stack_deallocate( void *stack )
#define CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE
-#define CONFIGURE_TASK_STACK_ALLOCATOR task_stack_allocate
+#define CONFIGURE_TASK_STACK_ALLOCATOR test_task_stack_allocate
-#define CONFIGURE_TASK_STACK_DEALLOCATOR task_stack_deallocate
+#define CONFIGURE_TASK_STACK_DEALLOCATOR test_task_stack_deallocate
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
diff --git a/testsuites/validation/tx-support.c b/testsuites/validation/tx-support.c
index f390d08ddd..3f41203a74 100644
--- a/testsuites/validation/tx-support.c
+++ b/testsuites/validation/tx-support.c
@@ -211,7 +211,10 @@ rtems_task_priority GetPriorityByScheduler(
priority = PRIO_INVALID;
sc = rtems_task_get_priority( task_id, scheduler_id, &priority );
- T_quiet_rsc_success( sc );
+
+ if ( sc != RTEMS_SUCCESSFUL ) {
+ return PRIO_INVALID;
+ }
return priority;
}
@@ -430,6 +433,24 @@ rtems_id CreateMutexNoProtocol( void )
return id;
}
+rtems_id CreateMutexFIFO( 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_FIFO,
+ 0,
+ &id
+ );
+ T_rsc_success( sc );
+
+ return id;
+}
+
void DeleteMutex( rtems_id id )
{
if ( id != INVALID_ID ) {
diff --git a/testsuites/validation/tx-support.h b/testsuites/validation/tx-support.h
index d3244e9ab2..fcabd1108b 100644
--- a/testsuites/validation/tx-support.h
+++ b/testsuites/validation/tx-support.h
@@ -78,6 +78,24 @@ typedef enum {
#define PRIO_INVALID 0xfffffffe
/**
+ * @brief This constants represents a priority which is close to the priority
+ * of the idle thread.
+ *
+ * It may be used for the runner thread together with PRIO_FLEXIBLE for worker
+ * threads.
+ */
+#define PRIO_NEARLY_IDLE 254
+
+/**
+ * @brief This constants represents a priority with a wider range of higher and
+ * lower priorities around it.
+ *
+ * It may be used for the worker threads together with PRIO_NEARLY_IDLE for the
+ * runner thread.
+ */
+#define PRIO_FLEXIBLE 128
+
+/**
* @brief This constants represents an invalid RTEMS object identifier.
*/
#define INVALID_ID 0xfffffffd
@@ -99,6 +117,8 @@ typedef enum {
#define SCHEDULER_C_ID 0xf010003
+#define SCHEDULER_D_ID 0xf010004
+
rtems_id DoCreateTask( rtems_name name, rtems_task_priority priority );
void StartTask( rtems_id id, rtems_task_entry entry, void *arg );
@@ -182,6 +202,8 @@ rtems_id CreateMutex( void );
rtems_id CreateMutexNoProtocol( void );
+rtems_id CreateMutexFIFO( void );
+
bool IsMutexOwner( rtems_id id );
void DeleteMutex( rtems_id id );
diff --git a/testsuites/validation/tx-thread-queue.c b/testsuites/validation/tx-thread-queue.c
index 7081cd35f3..30d5e6f3cf 100644
--- a/testsuites/validation/tx-thread-queue.c
+++ b/testsuites/validation/tx-thread-queue.c
@@ -248,11 +248,11 @@ void TQSetScheduler(
#endif
}
-static void Enqueue( TQContext *ctx, TQWorkerKind worker )
+static void Enqueue( TQContext *ctx, TQWorkerKind worker, TQWait wait )
{
uint32_t counter;
- ctx->status[ worker ] = TQEnqueue( ctx, ctx->wait );
+ ctx->status[ worker ] = TQEnqueue( ctx, wait );
counter = ctx->counter;
++counter;
@@ -304,7 +304,11 @@ static void Worker( rtems_task_argument arg, TQWorkerKind worker )
}
if ( ( events & TQ_EVENT_ENQUEUE ) != 0 ) {
- Enqueue( ctx, worker );
+ Enqueue( ctx, worker, ctx->wait );
+ }
+
+ if ( ( events & TQ_EVENT_ENQUEUE_TIMED ) != 0 ) {
+ Enqueue( ctx, worker, TQ_WAIT_TIMED );
}
if ( ( events & TQ_EVENT_ENQUEUE_FATAL ) != 0 ) {
@@ -312,7 +316,7 @@ static void Worker( rtems_task_argument arg, TQWorkerKind worker )
if ( setjmp( ctx->before_enqueue ) == 0 ) {
ctx->status[ worker ] = STATUS_MINUS_ONE;
- Enqueue( ctx, worker );
+ Enqueue( ctx, worker, ctx->wait );
} else {
ctx->status[ worker ] = STATUS_DEADLOCK;
}
@@ -373,6 +377,14 @@ static void Worker( rtems_task_argument arg, TQWorkerKind worker )
TQMutexRelease( ctx, TQ_MUTEX_NO_PROTOCOL );
}
+ if ( ( events & TQ_EVENT_MUTEX_FIFO_OBTAIN ) != 0 ) {
+ TQMutexObtain( ctx, TQ_MUTEX_FIFO );
+ }
+
+ if ( ( events & TQ_EVENT_MUTEX_FIFO_RELEASE ) != 0 ) {
+ TQMutexRelease( ctx, TQ_MUTEX_FIFO );
+ }
+
if ( ( events & TQ_EVENT_SCHEDULER_RECORD_STOP ) != 0 ) {
TQSchedulerRecordStop( ctx );
}
@@ -420,6 +432,11 @@ static void BlockerE( rtems_task_argument arg )
Worker( arg, TQ_BLOCKER_E );
}
+static void WorkerF( rtems_task_argument arg )
+{
+ Worker( arg, TQ_WORKER_F );
+}
+
static void HelperA( rtems_task_argument arg )
{
Worker( arg, TQ_HELPER_A );
@@ -447,10 +464,14 @@ void TQInitialize( TQContext *ctx )
for ( i = 0; i < RTEMS_ARRAY_SIZE( ctx->mutex_id ); ++i ) {
rtems_attribute attributes;
- attributes = RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY;
+ attributes = RTEMS_BINARY_SEMAPHORE;
- if ( i != TQ_MUTEX_NO_PROTOCOL ) {
- attributes |= RTEMS_INHERIT_PRIORITY;
+ if ( i == TQ_MUTEX_NO_PROTOCOL ) {
+ attributes |= RTEMS_PRIORITY;
+ } else if ( i == TQ_MUTEX_FIFO ) {
+ attributes |= RTEMS_FIFO;
+ } else {
+ attributes |= RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY;
}
sc = rtems_semaphore_create(
@@ -473,6 +494,8 @@ void TQInitialize( TQContext *ctx )
StartTask( ctx->worker_id[ TQ_BLOCKER_D ], BlockerD, ctx );
ctx->worker_id[ TQ_BLOCKER_E ] = CreateTask( "BLKE", PRIO_LOW );
StartTask( ctx->worker_id[ TQ_BLOCKER_E ], BlockerE, ctx );
+ ctx->worker_id[ TQ_WORKER_F ] = CreateTask( "WRKF", PRIO_LOW );
+ StartTask( ctx->worker_id[ TQ_WORKER_F ], WorkerF, ctx );
ctx->worker_id[ TQ_HELPER_A ] = CreateTask( "HLPA", PRIO_LOW );
StartTask( ctx->worker_id[ TQ_HELPER_A ], HelperA, ctx );
ctx->worker_id[ TQ_HELPER_B ] = CreateTask( "HLPB", PRIO_LOW );
diff --git a/testsuites/validation/tx-thread-queue.h b/testsuites/validation/tx-thread-queue.h
index 213910c9b6..3d462ba449 100644
--- a/testsuites/validation/tx-thread-queue.h
+++ b/testsuites/validation/tx-thread-queue.h
@@ -55,11 +55,24 @@ extern "C" {
*/
typedef enum {
+ TQ_NODE_ONLY,
+ TQ_NODE_VITAL,
+ TQ_NODE_DISPENSABLE
+} TQNodeKind;
+
+typedef enum {
+ TQ_WAIT_STATE_BLOCKED,
+ TQ_WAIT_STATE_INTEND_TO_BLOCK,
+ TQ_WAIT_STATE_READY_AGAIN
+} TQWaitState;
+
+typedef enum {
TQ_BLOCKER_A,
TQ_BLOCKER_B,
TQ_BLOCKER_C,
TQ_BLOCKER_D,
TQ_BLOCKER_E,
+ TQ_WORKER_F,
TQ_HELPER_A,
TQ_HELPER_B,
TQ_HELPER_C,
@@ -71,6 +84,7 @@ typedef enum {
TQ_MUTEX_B,
TQ_MUTEX_C,
TQ_MUTEX_NO_PROTOCOL,
+ TQ_MUTEX_FIFO,
TQ_MUTEX_COUNT
} TQMutex;
@@ -112,7 +126,10 @@ typedef enum {
TQ_EVENT_MUTEX_NO_PROTOCOL_RELEASE = RTEMS_EVENT_18,
TQ_EVENT_ENQUEUE_FATAL = RTEMS_EVENT_19,
TQ_EVENT_MUTEX_C_OBTAIN = RTEMS_EVENT_20,
- TQ_EVENT_MUTEX_C_RELEASE = RTEMS_EVENT_21
+ TQ_EVENT_MUTEX_C_RELEASE = RTEMS_EVENT_21,
+ TQ_EVENT_MUTEX_FIFO_OBTAIN = RTEMS_EVENT_22,
+ TQ_EVENT_MUTEX_FIFO_RELEASE = RTEMS_EVENT_23,
+ TQ_EVENT_ENQUEUE_TIMED = RTEMS_EVENT_24
} TQEvent;
typedef enum {