diff options
Diffstat (limited to 'testsuites/sptests/sptimecounter01')
-rw-r--r-- | testsuites/sptests/sptimecounter01/init.c | 45 | ||||
-rw-r--r-- | testsuites/sptests/sptimecounter01/sptimecounter01.doc | 37 |
2 files changed, 56 insertions, 26 deletions
diff --git a/testsuites/sptests/sptimecounter01/init.c b/testsuites/sptests/sptimecounter01/init.c index 13a00209fa..ff5fe25a2d 100644 --- a/testsuites/sptests/sptimecounter01/init.c +++ b/testsuites/sptests/sptimecounter01/init.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2015, 2019 embedded brains GmbH. All rights reserved. + * Copyright (C) 2015, 2019 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifdef HAVE_CONFIG_H @@ -23,6 +36,7 @@ #include <bsp/bootcard.h> #include <rtems/score/timecounterimpl.h> +#include <rtems/score/percpu.h> #include <rtems/score/todimpl.h> #include <rtems/timecounter.h> #include <rtems/bsd.h> @@ -42,6 +56,8 @@ typedef struct { static test_context test_instance; +static Thread_Control executing; + static uint32_t test_get_timecount(struct timecounter *tc) { test_context *ctx; @@ -106,12 +122,17 @@ void boot_card(const char *cmdline) struct bintime bt; struct timeval tv; struct timespec ts; + Per_CPU_Control *cpu_self; ctx = &test_instance; tc = &ctx->tc; TEST_BEGIN(); + cpu_self = _Per_CPU_Get(); + cpu_self->executing = &executing; + cpu_self->heir = &executing; + assert(time(NULL) == TOD_SECONDS_1970_THROUGH_1988); rtems_bsd_bintime(&bt); @@ -196,11 +217,11 @@ void boot_card(const char *cmdline) assert(bt.sec == 1); assert(bt.frac == 18446744073708); - /* Ensure that the fraction overflows and the second remains constant */ + /* Check that a large delta yields a correct time */ ctx->counter = (0xf0000000 | 1) + TEST_FREQ; rtems_bsd_binuptime(&bt); assert(ctx->counter == (0xf0000000 | 2) + TEST_FREQ); - assert(bt.sec == 1); + assert(bt.sec == 2); assert(bt.frac == 18446742522092); test_install(ctx); @@ -233,8 +254,6 @@ static void stack_free(void *ptr) #define CONFIGURE_SCHEDULER_TABLE_ENTRIES { } -#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER 0 - #define CONFIGURE_TASK_STACK_ALLOCATOR stack_allocate #define CONFIGURE_TASK_STACK_DEALLOCATOR stack_free diff --git a/testsuites/sptests/sptimecounter01/sptimecounter01.doc b/testsuites/sptests/sptimecounter01/sptimecounter01.doc index 4a7442c2e6..85a236e68f 100644 --- a/testsuites/sptests/sptimecounter01/sptimecounter01.doc +++ b/testsuites/sptests/sptimecounter01/sptimecounter01.doc @@ -1,16 +1,27 @@ -/* - * Copyright (c) 2015 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ +# SPDX-License-Identifier: BSD-2-Clause + +# Copyright (c) 2015 embedded brains GmbH & Co. KG +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. This file describes the directives and concepts tested by this test set. |