The attached patch enables timer support in the nanox api for RTEMS (while
I haven't tried it, it looks like timers should already work from the mwin
api).  The patch is generated with "cvs diff -c3p"; let me know if you'd
prefer some other format.

allan

-- 
Allan N. Hessenflow      all...@kallisti.com
Index: src/nanox/srvmain.c
===================================================================
RCS file: /usr/cvs/microwin/src/nanox/srvmain.c,v
retrieving revision 1.27
diff -c -3 -p -r1.27 srvmain.c
*** src/nanox/srvmain.c 24 Jun 2005 00:26:57 -0000      1.27
--- src/nanox/srvmain.c 20 Jun 2009 17:09:43 -0000
*************** void
*** 939,944 ****
--- 939,949 ----
  GsSelect (GR_TIMEOUT timeout)
  {
          struct MW_UID_MESSAGE m;
+       unsigned long uid_timeout;
+ #if MW_FEATURE_TIMERS
+       struct timeval tout;
+ #endif
+       GR_EVENT_GENERAL *gp;
        int rc;
  
        /* perform pre-select duties, if any*/
*************** GsSelect (GR_TIMEOUT timeout)
*** 949,955 ****
        m.type = MV_UID_INVALID;
  
        /* wait up for events */
!       rc = uid_read_message (&m, timeout);
  
        /* return if timed-out or something went wrong */
        if (rc < 0) {
--- 954,976 ----
        m.type = MV_UID_INVALID;
  
        /* wait up for events */
!       if (timeout == (GR_TIMEOUT) -1)
!               uid_timeout = 0;
!       else {
! #if MW_FEATURE_TIMERS
!               if (GdGetNextTimeout(&tout, timeout)) {
!                       uid_timeout = tout.tv_sec * 1000 +
!                                     (tout.tv_usec + 500) / 1000;
!               } else
! #endif
!               {
!                       if (timeout == 0)
!                               uid_timeout = (unsigned long) -1;
!                       else
!                               uid_timeout = timeout;
!               }
!       }
!       rc = uid_read_message (&m, uid_timeout);
  
        /* return if timed-out or something went wrong */
        if (rc < 0) {
*************** GsSelect (GR_TIMEOUT timeout)
*** 957,962 ****
--- 978,998 ----
                        EPRINTF (" rc= %d, errno=%d\n", rc, errno);
                else {
                        /* timeout handling */
+ #if MW_FEATURE_TIMERS
+                       if (GdTimeout())
+ #else
+                       if (timeout != 0)
+ #endif
+                       {
+                               /* Timeout has occured.
+                               ** Currently return a timeout event regardless 
of whether client
+                               **   has selected for it.
+                               */
+                               if ((gp = (GR_EVENT_GENERAL 
*)GsAllocEvent(curclient)) != NULL)
+                               {
+                                       gp->type = GR_EVENT_TYPE_TIMEOUT;
+                               }
+                       }
                }
                return;
        }

---------------------------------------------------------------------
To unsubscribe, e-mail: nanogui-unsubscr...@linuxhacker.org
For additional commands, e-mail: nanogui-h...@linuxhacker.org

Reply via email to