[rtems-central commit] spec: Use rtems_task_construct()

Sebastian Huber sebh at rtems.org
Thu Sep 17 16:10:28 UTC 2020


Module:    rtems-central
Branch:    master
Commit:    712748b8a28cb50192a63f9cae406e5adfa9d69e
Changeset: http://git.rtems.org/rtems-central/commit/?id=712748b8a28cb50192a63f9cae406e5adfa9d69e

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Sep 17 17:45:44 2020 +0200

spec: Use rtems_task_construct()

---

 spec/rtems/event/req/send-receive.yml  | 39 ++++++++++++++++++++++------------
 spec/rtems/task/req/ident.yml          | 36 ++++++++++++++++++++++---------
 spec/testsuites/validation/profile.yml | 31 ++++++++++++++++++---------
 3 files changed, 72 insertions(+), 34 deletions(-)

diff --git a/spec/rtems/event/req/send-receive.yml b/spec/rtems/event/req/send-receive.yml
index 5723e57..f80514a 100644
--- a/spec/rtems/event/req/send-receive.yml
+++ b/spec/rtems/event/req/send-receive.yml
@@ -461,16 +461,6 @@ test-prepare: |
 test-setup:
   brief: null
   code: |
-    static char  task_storage[ RTEMS_MINIMUM_STACK_SIZE ];
-    static const rtems_task_config task_config = {
-      .name = rtems_build_name( 'W', 'O', 'R', 'K' ),
-      .initial_priority = PRIO_LOW,
-      .storage_area = task_storage,
-      .storage_size = sizeof( task_storage ),
-      .initial_modes = RTEMS_DEFAULT_MODES,
-      .attributes = RTEMS_DEFAULT_ATTRIBUTES
-    };
-
     rtems_status_code   sc;
     rtems_task_priority prio;
 
@@ -494,7 +484,7 @@ test-setup:
     T_rsc_success( sc );
     T_eq_u32( prio, PRIO_HIGH );
 
-    sc = rtems_task_build( &task_config, &ctx->worker_id );
+    sc = rtems_task_construct( &WorkerConfig, &ctx->worker_id );
     T_assert_rsc_success( sc );
 
     sc = rtems_task_start( ctx->worker_id, Worker, (rtems_task_argument) ctx );
@@ -504,7 +494,28 @@ test-stop: null
 test-support: |
   #define INPUT_EVENTS ( RTEMS_EVENT_5 | RTEMS_EVENT_23 )
 
-  typedef ReqRtemsEventSendReceive_Context Context;
+  #define WORKER_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
+
+  #define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT )
+
+  typedef RtemsEventReqSendReceive_Context Context;
+
+  RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) static char WorkerStorage[
+    RTEMS_TASK_STORAGE_SIZE(
+      MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE,
+      WORKER_ATTRIBUTES
+    )
+  ];
+
+  static const rtems_task_config WorkerConfig = {
+    .name = rtems_build_name( 'W', 'O', 'R', 'K' ),
+    .initial_priority = PRIO_LOW,
+    .storage_area = WorkerStorage,
+    .storage_size = sizeof( WorkerStorage ),
+    .maximum_thread_local_storage_size = MAX_TLS_SIZE,
+    .initial_modes = RTEMS_DEFAULT_MODES,
+    .attributes = WORKER_ATTRIBUTES
+  };
 
   static rtems_id CreateWakeupSema( void )
   {
@@ -677,11 +688,11 @@ test-support: |
     return pending;
   }
 
-  static void ReqRtemsEventSendReceive_Cleanup( Context *ctx );
+  static void RtemsEventReqSendReceive_Cleanup( Context *ctx );
 
   static void InterruptPrepare( void *arg )
   {
-    ReqRtemsEventSendReceive_Cleanup( arg );
+    RtemsEventReqSendReceive_Cleanup( arg );
   }
 
   static void InterruptAction( void *arg )
diff --git a/spec/rtems/task/req/ident.yml b/spec/rtems/task/req/ident.yml
index 2769cea..e1276cc 100644
--- a/spec/rtems/task/req/ident.yml
+++ b/spec/rtems/task/req/ident.yml
@@ -80,18 +80,12 @@ test-prepare: null
 test-setup:
   brief: null
   code: |
-    static char task_storage[ RTEMS_MINIMUM_STACK_SIZE ];
-    static const rtems_task_config task_config = {
-      .name = ClassicObjectIdentName,
-      .initial_priority = 1,
-      .storage_area = task_storage,
-      .storage_size = sizeof( task_storage ),
-      .initial_modes = RTEMS_DEFAULT_MODES,
-      .attributes = RTEMS_DEFAULT_ATTRIBUTES
-    };
     rtems_status_code sc;
 
-    sc = rtems_task_build( &task_config, &ctx->id_local_object );
+    sc = rtems_task_construct(
+      &ClassicTaskIdentConfig,
+      &ctx->id_local_object
+    );
     T_assert_rsc_success( sc );
   description: null
 test-stop: null
@@ -104,6 +98,28 @@ test-support: |
   {
     return rtems_task_ident( name, node, id );
   }
+
+  #define TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
+
+  #define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT )
+
+  RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT )
+  static char ClassicTaskIdentStorage[
+    RTEMS_TASK_STORAGE_SIZE(
+      MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE,
+      TASK_ATTRIBUTES
+    )
+  ];
+
+  static const rtems_task_config ClassicTaskIdentConfig = {
+    .name = ClassicObjectIdentName,
+    .initial_priority = 1,
+    .storage_area = ClassicTaskIdentStorage,
+    .storage_size = sizeof( ClassicTaskIdentStorage ),
+    .maximum_thread_local_storage_size = MAX_TLS_SIZE,
+    .initial_modes = RTEMS_DEFAULT_MODES,
+    .attributes = TASK_ATTRIBUTES
+  };
 test-target: testsuites/validation/tc-task-ident.c
 test-teardown: null
 text: ${.:text-template}
diff --git a/spec/testsuites/validation/profile.yml b/spec/testsuites/validation/profile.yml
index 8cc3d67..ca34f5b 100644
--- a/spec/testsuites/validation/profile.yml
+++ b/spec/testsuites/validation/profile.yml
@@ -35,7 +35,16 @@ test-code: |
     rtems_fatal(RTEMS_FATAL_SOURCE_APPLICATION, 123);
   }
 
-  static char init_task_storage[RTEMS_MINIMUM_STACK_SIZE];
+  #define INIT_TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
+
+  #define MAX_TLS_SIZE RTEMS_ALIGN_UP(64, RTEMS_TASK_STORAGE_ALIGNMENT)
+
+  RTEMS_ALIGNED(RTEMS_TASK_STORAGE_ALIGNMENT) static char init_task_storage[
+    RTEMS_TASK_STORAGE_SIZE(
+      MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE,
+      INIT_TASK_ATTRIBUTES
+    )
+  ];
 
   static char buffer[512];
 
@@ -70,16 +79,18 @@ test-code: |
     .actions = actions
   };
 
+  static const rtems_task_config task_config = {
+    .name = NAME,
+    .initial_priority = 1,
+    .storage_area = init_task_storage,
+    .storage_size = sizeof(init_task_storage),
+    .maximum_thread_local_storage_size = MAX_TLS_SIZE,
+    .initial_modes = RTEMS_DEFAULT_MODES,
+    .attributes = INIT_TASK_ATTRIBUTES
+  };
+
   static void init_task(void)
   {
-    static const rtems_task_config task_config = {
-      .name = NAME,
-      .initial_priority = 1,
-      .storage_area = init_task_storage,
-      .storage_size = sizeof(init_task_storage),
-      .initial_modes = RTEMS_DEFAULT_MODES,
-      .attributes = RTEMS_DEFAULT_ATTRIBUTES
-    };
     rtems_id id;
     rtems_status_code sc;
 
@@ -87,7 +98,7 @@ test-code: |
     T_case_begin("SpaceProfileTaskBuild", NULL);
     T_plan(2);
 
-    sc = rtems_task_build(&task_config, &id);
+    sc = rtems_task_construct(&task_config, &id);
     T_step_rsc_success(0, sc);
 
     sc = rtems_task_start(id, Init, 0);



More information about the vc mailing list