summaryrefslogtreecommitdiffstats
path: root/testsuites/validation/tc-clock-nanosleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/validation/tc-clock-nanosleep.c')
-rw-r--r--testsuites/validation/tc-clock-nanosleep.c78
1 files changed, 33 insertions, 45 deletions
diff --git a/testsuites/validation/tc-clock-nanosleep.c b/testsuites/validation/tc-clock-nanosleep.c
index 2857d8e274..514f5376ba 100644
--- a/testsuites/validation/tc-clock-nanosleep.c
+++ b/testsuites/validation/tc-clock-nanosleep.c
@@ -3,11 +3,11 @@
/**
* @file
*
- * @ingroup RTEMSTestCaseCReqClockNanosleep
+ * @ingroup CReqClockNanosleep
*/
/*
- * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2021 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -64,9 +64,9 @@
#include <rtems/test.h>
/**
- * @defgroup RTEMSTestCaseCReqClockNanosleep spec:/c/req/clock-nanosleep
+ * @defgroup CReqClockNanosleep spec:/c/req/clock-nanosleep
*
- * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ * @ingroup TestsuitesValidationNoClock0
*
* @{
*/
@@ -166,29 +166,29 @@ typedef struct {
/**
* @brief This member provides the scheduler operation records.
*/
- T_scheduler_log_4 scheduler_log;;
+ T_scheduler_log_4 scheduler_log;
/**
* @brief This member contains the CLOCK_REALTIME value before the
* clock_nanosleep() call.
*/
- struct timespec now_realtime;;
+ struct timespec now_realtime;
/**
* @brief This member contains the CLOCK_MONOTONIC value before the
* clock_nanosleep() call.
*/
- struct timespec now_monotonic;;
+ struct timespec now_monotonic;
/**
* @brief This member contains the worker task identifier.
*/
- rtems_id worker_id;;
+ rtems_id worker_id;
/**
* @brief This member contains the timer information of the worker task.
*/
- TaskTimerInfo timer_info;;
+ TaskTimerInfo timer_info;
/**
* @brief This member provides the object referenced by the ``rqtp``
@@ -325,14 +325,20 @@ static void Worker( rtems_task_argument arg )
while ( true ) {
T_scheduler_log *log;
+ uint32_t counter;
SuspendSelf();
log = T_scheduler_record_4( &ctx->scheduler_log );
T_null( log );
- _Timecounter_Getnanotime( &ctx->now_realtime );
- _Timecounter_Getnanouptime( &ctx->now_monotonic );
+ counter = GetTimecountCounter();
+ _Timecounter_Nanotime( &ctx->now_realtime );
+ SetTimecountCounter( counter );
+
+ counter = GetTimecountCounter();
+ _Timecounter_Nanouptime( &ctx->now_monotonic );
+ SetTimecountCounter( counter );
ctx->status = clock_nanosleep(
ctx->clock_id,
@@ -424,7 +430,7 @@ static void CReqClockNanosleep_Pre_RQTp_Prepare(
case CReqClockNanosleep_Pre_RQTp_Null: {
/*
- * While the ``rqtp parameter is equal to NULL.
+ * While the ``rqtp`` parameter is equal to NULL.
*/
ctx->rqtp = NULL;
break;
@@ -537,7 +543,7 @@ static void CReqClockNanosleep_Pre_RMTp_Prepare(
case CReqClockNanosleep_Pre_RMTp_Null: {
/*
- * While the ``rmtp parameter is equal to NULL.
+ * While the ``rmtp`` parameter is equal to NULL.
*/
ctx->rmtp = NULL;
break;
@@ -653,16 +659,10 @@ static void CReqClockNanosleep_Post_Expire_Check(
case CReqClockNanosleep_Post_Expire_Relative: {
/*
* The timer of the calling task shall expire at the time point specified
- * by the sum of the current time of the clock specified by the
- * ``clock_id`` parameter and the interval specified by the ``rqtp``
- * parameter.
+ * by the sum of the current time of the clock specified by
+ * CLOCK_MONOTONIC and the interval specified by the ``rqtp`` parameter.
*/
- if ( ctx->clock_id == CLOCK_REALTIME ) {
- expire = ctx->now_realtime;
- } else {
- expire = ctx->now_monotonic;
- }
-
+ expire = ctx->now_monotonic;
expire.tv_sec += ctx->rqtp_obj.tv_sec;
expire.tv_nsec += ctx->rqtp_obj.tv_nsec;
@@ -849,22 +849,10 @@ CReqClockNanosleep_Entries[] = {
CReqClockNanosleep_Post_Expire_Last,
CReqClockNanosleep_Post_Scheduler_Block, CReqClockNanosleep_Post_RMTp_Nop },
{ 0, 0, 0, 0, 0, 0, 0, CReqClockNanosleep_Post_Status_Zero,
- CReqClockNanosleep_Post_Timer_Realtime,
- CReqClockNanosleep_Post_Expire_Last,
- CReqClockNanosleep_Post_Scheduler_Block, CReqClockNanosleep_Post_RMTp_Nop },
- { 0, 0, 0, 0, 0, 0, 0, CReqClockNanosleep_Post_Status_Zero,
CReqClockNanosleep_Post_Timer_Monotonic,
CReqClockNanosleep_Post_Expire_Absolute,
CReqClockNanosleep_Post_Scheduler_Block, CReqClockNanosleep_Post_RMTp_Nop },
{ 0, 0, 0, 0, 0, 0, 0, CReqClockNanosleep_Post_Status_Zero,
- CReqClockNanosleep_Post_Timer_Inactive, CReqClockNanosleep_Post_Expire_NA,
- CReqClockNanosleep_Post_Scheduler_BlockUnblock,
- CReqClockNanosleep_Post_RMTp_Zero },
- { 0, 0, 0, 0, 0, 0, 0, CReqClockNanosleep_Post_Status_Zero,
- CReqClockNanosleep_Post_Timer_Realtime,
- CReqClockNanosleep_Post_Expire_Absolute,
- CReqClockNanosleep_Post_Scheduler_Block, CReqClockNanosleep_Post_RMTp_Nop },
- { 0, 0, 0, 0, 0, 0, 0, CReqClockNanosleep_Post_Status_Zero,
CReqClockNanosleep_Post_Timer_Monotonic,
CReqClockNanosleep_Post_Expire_Last,
CReqClockNanosleep_Post_Scheduler_Block, CReqClockNanosleep_Post_RMTp_Zero },
@@ -877,26 +865,26 @@ CReqClockNanosleep_Entries[] = {
CReqClockNanosleep_Post_Expire_Relative,
CReqClockNanosleep_Post_Scheduler_Block, CReqClockNanosleep_Post_RMTp_Nop },
{ 0, 0, 0, 0, 0, 0, 0, CReqClockNanosleep_Post_Status_Zero,
- CReqClockNanosleep_Post_Timer_Realtime,
- CReqClockNanosleep_Post_Expire_Last,
- CReqClockNanosleep_Post_Scheduler_Block, CReqClockNanosleep_Post_RMTp_Zero },
+ CReqClockNanosleep_Post_Timer_Inactive, CReqClockNanosleep_Post_Expire_NA,
+ CReqClockNanosleep_Post_Scheduler_BlockUnblock,
+ CReqClockNanosleep_Post_RMTp_Zero },
{ 0, 0, 0, 0, 0, 0, 0, CReqClockNanosleep_Post_Status_Zero,
CReqClockNanosleep_Post_Timer_Realtime,
- CReqClockNanosleep_Post_Expire_Relative,
- CReqClockNanosleep_Post_Scheduler_Block, CReqClockNanosleep_Post_RMTp_Zero },
+ CReqClockNanosleep_Post_Expire_Last,
+ CReqClockNanosleep_Post_Scheduler_Block, CReqClockNanosleep_Post_RMTp_Nop },
{ 0, 0, 0, 0, 0, 0, 0, CReqClockNanosleep_Post_Status_Zero,
CReqClockNanosleep_Post_Timer_Realtime,
- CReqClockNanosleep_Post_Expire_Relative,
+ CReqClockNanosleep_Post_Expire_Absolute,
CReqClockNanosleep_Post_Scheduler_Block, CReqClockNanosleep_Post_RMTp_Nop }
};
static const uint8_t
CReqClockNanosleep_Map[] = {
- 6, 6, 8, 8, 10, 10, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 7, 2, 13, 8, 14, 15, 11, 6, 7, 2, 7, 2, 7, 2, 7, 2, 3,
- 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 6, 6, 9, 9, 12, 12, 6, 6, 2, 2,
- 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 2, 16,
- 9, 17, 18, 11, 6, 7, 2, 7, 2, 7, 2, 7, 2, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0,
+ 6, 6, 8, 8, 9, 9, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 7, 2, 10, 8, 11, 12, 13, 6, 7, 2, 7, 2, 7, 2, 7, 2, 3, 0,
+ 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 6, 6, 14, 14, 15, 15, 6, 6, 2, 2,
+ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 2, 10,
+ 8, 11, 12, 13, 6, 7, 2, 7, 2, 7, 2, 7, 2, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0,
3, 0, 3, 0, 4, 4, 4, 4, 5, 5, 5, 5, 4, 4, 4, 4, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 5, 5, 5, 5, 4, 4, 4, 4, 5, 5, 5, 5,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1