public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: David Fernandez <david.fernandez.work@googlemail.com>
To: Grant Edwards <grant.b.edwards@gmail.com>,
		eCos Discussion <ecos-discuss@ecos.sourceware.org>
Subject: [ECOS] Re: Cortex-M3 failing certain kernel tests
Date: Mon, 30 Sep 2013 12:13:00 -0000	[thread overview]
Message-ID: <CAA6dH33NX6E0MTRqxAoL=pHkgiLQ+V=CAM=FqQ7KFp4aaEemVQ@mail.gmail.com> (raw)

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 <sys/types.h>
 # include <pthread.h>
 # include <semaphore.h>
 # include <time.h>
+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 <unistd.h>
 #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

             reply	other threads:[~2013-09-30 12:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-30 12:13 David Fernandez [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-09-28 13:52 David Fernandez
2013-09-28 15:58 ` Grant Edwards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA6dH33NX6E0MTRqxAoL=pHkgiLQ+V=CAM=FqQ7KFp4aaEemVQ@mail.gmail.com' \
    --to=david.fernandez.work@googlemail.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=grant.b.edwards@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).