From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15158 invoked by alias); 30 Sep 2013 12:13:41 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 15135 invoked by uid 89); 30 Sep 2013 12:13:40 -0000 Received: from mail-pa0-f46.google.com (HELO mail-pa0-f46.google.com) (209.85.220.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 30 Sep 2013 12:13:40 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,NO_RELAYS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f46.google.com Received: by mail-pa0-f46.google.com with SMTP id fa1so5792967pad.19 for ; Mon, 30 Sep 2013 05:13:38 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.68.113.99 with SMTP id ix3mr2448407pbb.180.1380543218171; Mon, 30 Sep 2013 05:13:38 -0700 (PDT) Received: by 10.70.50.129 with HTTP; Mon, 30 Sep 2013 05:13:38 -0700 (PDT) Date: Mon, 30 Sep 2013 12:13:00 -0000 Message-ID: From: David Fernandez To: Grant Edwards , eCos Discussion Content-Type: text/plain; charset=ISO-8859-1 Subject: [ECOS] Re: Cortex-M3 failing certain kernel tests X-SW-Source: 2013-09/txt/msg00019.txt.bz2 Grant, This is what I did for pmutex3.c which has the same problem. I did not found the same problem in kmutex3.c... may be it was kind of fixed in the cvs pulled version I'm using. Nevertheless, this should be kind of generic, the conversion functions come from posix private code in ecos, but they can be put as test helper code using other than timespec for normal kernel tests. I've used a macro that can be replaced with an expression of the numerator and denominator time tick parameters, to use the "simplified" code when the tick is set to 10ms, but I guess that having conversion functions is better. $ cvs diff -U5 packages/compat/posix/current/tests/pmutex3.c Index: packages/compat/posix/current/tests/pmutex3.c =================================================================== RCS file: /cvs/ecos/ecos/packages/compat/posix/current/tests/pmutex3.c,v retrieving revision 1.2 diff -U 5 -r1.2 pmutex3.c --- packages/compat/posix/current/tests/pmutex3.c 29 Jan 2009 17:47:52 -0000 1.2 +++ packages/compat/posix/current/tests/pmutex3.c 30 Sep 2013 12:03:27 -0000 @@ -58,10 +58,14 @@ #ifdef CYGPKG_ISOINFRA # include # include # include # include +typedef cyg_uint64 cyg_tick_count; +externC void cyg_ticks_to_timespec( cyg_tick_count ticks, struct timespec *tp ); +externC cyg_tick_count cyg_timespec_to_ticks( const struct timespec *tp, + cyg_bool roundup); # include #endif #if !defined(CYGPKG_POSIX_PTHREAD) #define NA_MSG "POSIX threads not enabled" @@ -332,11 +336,15 @@ // better, so that is what we will do. Must be a busy-wait. then = cyg_current_time(); do { now = cyg_current_time(); // Wait longer than the delay in t3 waiting on go_flag +#if defined(CYGOPT_POSIX_MUTEX3_10MS_DELAY) + } while ( now < (then + cyg_timespec_to_ticks(&sleeptime, false)) ); +#else /*defined(CYGOPT_POSIX_MUTEX3_10MS_DELAY)*/ } while ( now < (then + 3) ); +#endif/*defined(CYGOPT_POSIX_MUTEX3_10MS_DELAY)*/ #ifdef _POSIX_THREAD_PRIO_INHERIT CYG_TEST_INFO( "Checking for mutex priority inheritance" ); CYG_TEST_CHECK( 1 == t3ran, "Thread 3 did not run" ); CYG_TEST_CHECK( 1 == got_it, "Thread 1 did not get the mutex" ); @@ -418,12 +426,16 @@ // Emulate resume behaviour sem_wait( &hold[id] ); if( all_exit ) return 0; // one tick sleep time +#if defined(CYGOPT_POSIX_MUTEX3_10MS_DELAY) sleeptime.tv_nsec = 10000000; sleeptime.tv_sec = 0; +#else /*defined(CYGOPT_POSIX_MUTEX3_10MS_DELAY)*/ + cyg_ticks_to_timespec(1, &sleeptime); +#endif/*defined(CYGOPT_POSIX_MUTEX3_10MS_DELAY)*/ CYG_TEST_INIT(); CYG_TEST_INFO( "Control Thread running" ); // Go through the 27 possibilitied of resuming the extra threads -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss